Flurry
Flurry is implemented as a plugin to the AdManager. You init it with your apps Flurry ID, then you can make calls to track specific pages, which will later show up in the Flurry dev console.
Currently supported on Android only.
Requires an AdManager object to be setup to use.
Adding Flurry to the AdManager
- Add /shared/Ad/AdProviderFlurry.cpp to your project
Add the following under your other #include's near the top of App.cpp:
#ifdef RT_FLURRY_ENABLED #include "Ad/AdProviderFlurry.h" #endif
Note, the #ifdefs I use are not really required here, but it's useful so you can turn on/off different ad systems easily for specific builds or platforms.
Next, add the following code under the existing m_adManager.Init() statement. (You did already setup AdManager, right?!)
#ifdef RT_FLURRY_ENABLED AdProviderFlurry *pFlurryProvider = new AdProviderFlurry; pFlurryProvider->SetupInfo("<your flurry API key>"); m_adManager.AddProvider(pFlurryProvider); #endif Note: You'll need to replace the <your flurry api key> part with the stuff you cut and paste from the Flurry control panel.
In your App.h, add the following somewhere so Flurry will actually be used. (You can still compile with it under Windows builds for testing, it just won't do much)
#define RT_FLURRY_ENABLED
Tracking stuff. To actually track data with Flurry, you do it this way:
//on your about menu, you could add this to see how many people actually look at it: GetApp()->GetAdManager()->TrackingLog("AboutMenu"); //when someone buys IAP, you could add this to track what people are buying: GetApp()->GetAdManager()->TrackingLog("BoughtIAP", "powerBoots", "$1.99"); //limited to two "extra" parms, besides the main page name
Enabling Flurry for Windows Android build
These directions assume you are using the proton v2 android build system, which nearly all examples use now. You can look at RTAdManager for an example if needed.
The plugin will automatically handle creating multiple Flurry sessions upon suspend/resume as needed.
First, download the Flurry SDK for Android (you'll need a Flurry account to see that option) and place FlurryAgent.jar in the \shared\android\optional_src\libs\Flurry, which should exist already. I can't include this file in p+ for legal reasons.
* Add -DRT_FLURRY_ENABLED to the SHARED_FLAGS variable in your /android/jni/Android.mk file, in case it isn't defined in your App.h * Make sure shared/Managers/AdManager.cpp, shared/Ad/AdProvider.cpp, and shared/Ad/AdProviderFlurry.cpp are added to your /android/jni/Android.mk file
In your build_prepare.bat, you should see this somewhere already:
:for Flurry (comment out the goto if you want to use it) goto skipflurry; set TEMPFILE=..\..\shared\android\optional_src\libs\Flurry\FlurryAgent.jar :Extra check to make sure we can locate the files if exist "%TEMPFILE%" ( echo Located flurry files. ) else ( echo Cannot find FlurryAgent.jar. Download and place lib into shared\android\optional_src\libs\Flurry ..\..\shared\win\utils\beeper.exe /p ) copy %TEMPFILE% libs :skipflurry
Change “:goto skipflurry;” to “goto skipflurry;”, this will cause the flurry jar file to get copied to libs during the build process.
Next, edit your android/src/Main.java and change
// #define RT_FLURRY_SUPPORT
to
//#define RT_FLURRY_SUPPORT
to enable it.
The android/AndroidManifest.xml doesn't require any special changes or privileges.
That's it, Flurry should work in your Android build now.
Note: When testing, the Flurry control panel seemed very slow to show activity, like 10+ hours to update. So if it seems like it isn't working, you may just want to wait a bit.
Important note about Flurry on Android
Flurry actually sends the the statistical data it's collected when it closes the session. However, if you send the MESSAGE_FINISH_APP message, the app will shutdown and close before Flurry can finish sending. (It doesn't start its own activity)
To work around this, don't send MESSAGE_FINISH_APP or have a quit button. Alternately, if you really want the Back button from the main menu to appear to quit, send MESSAGE_SUSPEND_TO_HOME_SCREEN instead. The app will suspend and allow Flurry to do its thing, but will actually get killed later when the OS decides it wants the memory, similarly to how iOS does it.
RTAdTest does it this way, you can check it for an example.