Get Started With Android

Basic Setup

You can gain deep insight into your customer’s behavior very quickly and with little effort using Flurry’s Analytics service. The SDK integration process is designed to be as easy as possible with a basic setup you can complete in a short period of time.

Download the Flurry Android SDK

The archive should contain these files for use with Flurry Analytics:

  • FlurryAnalytics_x.y.z.jar: The library containing Flurry’s analytic collection and reporting code (where x.y.x denotes the latest version of Flurry SDK).

  • FlurryAds_x.y.z.jar: The optional library to incorporate Flurry’s ads into your application (where x.y.x denotes the latest version of Flurry SDK).

  • ProjectApiKey.txt: This file contains the name of your project and your project’s API key.

  • Analytics-README.pdf : A PDF file with instructions.

Add the FlurryAnalytics_x.y.z.jar to your classpath

  1. If you’re using Eclipse, modify your Java Build Path, and choose Add External JAR.

  2. If you’re using the SDK tools directly, drop it into your libs folder and the ant task will pick it up.

Add calls to onStartSession and onEndSession

Add the following three lines of Java code to each Activity of your app. This enables you to accurately capture the duration of your users’ interaction with the app.

Next, follow these steps:

  1. Insert a call to FlurryAgent.onStartSession(Context, String), passing it a reference to a Context object (such as an Activity or Service), and to your project’s API key.

Important: We recommend using the onStart method of each Activity in your app, and passing the Activity (or Service) itself as the Context object. Passing the global Application context is not recommended.

  1. Insert a call to FlurryAgent.onEndSession(Context) when a session is complete.

Important: Flurry recommends using the onStop method of each Activity in your application. Make sure you match up a call to onEndSession for each call of onStartSession, passing in the same Context object that was used to call onStartSession.

Note: As there is any Context that has called onStartSession but not onEndSession, the session is continued. If a new Context calls onStartSession within 10 seconds of the last Context calling onEndSession, then the session is resumed instead of a new session being created. This ensures that as a user transitions from one Activity to another in your app, they do not have a separate session tracked for each Activity, but have a single session that spans many activities. If you want to track specific Activity usage, Flurry recommends Custom Events, documented in the next section.

If you want to change the time window during which a session can be resumed, call FlurryAgent.setContinueSessionMillis(long milliseconds) before the first call to FlurryAgent.onStartSession.

Following these steps provides you with access to the wide range of features listed below. In the Lexicon section of the documentation, you’ll find detailed descriptions of these features and terms.

  • Sessions

  • Active Users

  • New Users

  • Session Length

  • Frequency of Use

  • Page Views

  • Custom User Segments

  • Lifecycle Metrics

  • User Retention

  • Version Adoption

  • Cross-App Usage

  • Demographic Estimates

  • Time of Day Reporting

  • Geographic Usage

  • Language Metrics

  • Devices

  • Carriers

  • Firmware Versions

Now that you’ve completed the basic setup, you are ready to move on to custom events, which enable you to better understand user behavior through tracking Custom Events.