Integrate Flurry SDK for Android¶
Integrating with the Flurry SDK is easy and straightforward for Android developers.
Follow these instructions and in no time at all, you’ll be ready to start logging events and monetizing your apps.
Prerequisites: Android API level 16 and higher if using SDK version 8.0.0 or newer. Older SDK versions are API 10 and higher.
Create an App & Get Your API Key¶
Start by creating an app. Once you create the app, you’ll receive a Flurry API Key, which you’ll need when using the SDK.
You need to have the administrator role on your company’s account to be able to create a new app within the company.
For each distinct app that you create, you’ll need to acquire a unique Flurry API Key.
Install Flurry Android SDK¶
If you are looking to manually download the Flurry SDK and add the .jar files follow the instructions for Manual SDK Integrations.
We recommend installing the Flurry SDK via jcenter, instructions are as follows.
Install via jcenter¶
The Flurry SDK is available via jcenter. You can add it to your application by including the following in your
It is highly recommended to use the AAR format of the Flurry SDK. Using jars is now deprecated. Please update to AARs as Flurry will be removing jars in a future release.
If you are adding the AAR format of the Flurry dependencies, you do not need to modify your AndroidManifest files or ProGuard configuration.
Add the following calls to initialize the Flurry SDK by using the FlurryAgent.Builder to initialize the Flurry SDK with your project’s API key. We generally expect users to initialize FlurryAgent in their Application class, and pass in the Application context. Flurry will start a new session when the next Activity is in the foreground.
If your app can only initialize the FlurryAgent in an Activity, passing the Application context will cause the session not to start until the next Activity comes into the foreground.
In this case, pass the Activity context instead to initialize FlurryAgent. The new session will start immediately.
It is safe to call the Builder more than once, provided that you use the same API key throughout the application. The following methods are now deprecated: setFlurryAgentListener(), setLogEnabled(), setLogLevel(), setContinueSessionMillis(), setCaptureUncaughtExceptions(), setPulseEnabled() and init().
If you want to call logEvent() directly after calling build(), it is best to register a Flurry Agent listener with
withListener() to make sure the SDK is initialized before logging. If you wish to make calls to logEvent() directly after initializing the SDK, it is best to register the listener
FlurryAgentListener.onStartSession() for when the session has started. This will allow you to capture events as soon as the session is ready.
Now test run your Android app and ensure that it builds without errors. If everything is working properly, a session will be recorded in Flurry and should be visible on your Real Time dashboard within 30 seconds.
If you created the Flurry app within the last 5 minutes, the app may not yet be live on our servers and thus will not reflect real-time data. Re-run your app after 5 minutes to see your session recorded on the Real Time dashboard.
Congratulations! Your Android app is now ready to be used with Flurry Analytics.
Integrating Other Analytics Features¶
Was this document helpful?