Manual Flurry Android SDK Integration

If you are looking to install the Flurry SDK via jcenter follow the instructions for Install via jcenter.

Install Flurry SDK .jar files

If you are looking to directly download the Flurry SDK packaged in .jar files, follow these steps:

  1. Download .jar files from Flurry Dev Portal
android sdk download

The downloaded 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.
  • flurryAds-x.y.z.jar: The optional library to incorporate Flurry’s ads into your application.
  • ProjectApiKey.txt: This file contains the name of your project and your project’s API key.
  • FlurryAndroidAnalyticsReadmevx.y.z.pdf: A PDF file with instructions (where x.y.x denotes the latest version of Flurry SDK).
  1. Add .jar files to your project. This can be performed using Android Studio or Eclipse.

Using Android Studio:

  1. Add flurryAnalytics-x.y.z.jar to your project’s libs folder.
  2. If you also want to integrate Flurry Advertising, add the flurryAds-x.y.x.jar to your project’s libs folder.
  3. Navigate to File > Project Structure > Module > Dependencies. Click the ‘+’ button in the bottom of the ‘Project Structure’ popup to add dependencies. Select ‘File dependency’ and add libs/flurryAnalytics-x.y.z.jar.
  4. Add Google Play Services library. If selectively compiling individual Google Play Service APIs, you should include the Google Analytics API.

Using Eclipse

  1. Add flurryAnalytics-x.y.z.jar to your project’s libs folder. Right-click on each JAR file and select Build Path > Add to Build Path.
  2. If you also want to integrate Flurry Advertising, add the flurryAds-x.y.z.jar to your project’s libs folder.
  3. Right-click on each JAR file and select Build Path > Add to Build Path.
  4. Add the Google Play Service library jar file.

Important

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.

Note

If you are adding the AAR format of the Flurry dependencies, you do not need to modify your AndroidManifest files or ProGuard configuration.

Configure the AndroidManifest and ProGuard Files

Below is an example of an AndroidManifest.xml file configured for both Flurry Analytics and Flurry Advertising.

<manifest xmlns:android="http://schemas.android.com/apk/res/android"
        package="com.flurry.sample"
        android:versionCode="1"
        android:versionName="1.0" >

        <!-- Required permissions - Internet access -->
        <uses-permission android:name="android.permission.INTERNET" />
        <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
        <!-- Highly Recommended permission - External memory pre-caching -->
        <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
        <!-- Optional permission - Location based ad targeting -->
        <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />

        <application
            android:name=".MyApplication"
            android:allowBackup="true"
            android:icon="@mipmap/app_icon"
            android:label="@string/app_name"
            android:theme="@style/AppTheme" >
            <!-- Required Activities if using Flurry Advertising -->
            <activity
               android:name="com.flurry.android.FlurryFullscreenTakeoverActivity"
               android:configChanges="keyboard|keyboardHidden|orientation|screenLayout|uiMode| screenSize|smallestScreenSize">
            </activity>

        </application>
    </manifest>

Required Permission

Required to send analytics data back to the flurry servers

android.permission.INTERNET

Optional Permission (Highly Recommended)

If your application has network state permissions, transmission of analytics data can be optimized and the SDK can use the device’s external memory for pre-caching

android.permission.ACCESS_NETWORK_STATE
android.permission.WRITE_EXTERNAL_STORAGE

Optional Permission

Flurry Analytics will use PASSIVE_PROVIDER to get the location information. Otherwise it will use the NETWORK_PROVIDER to fetch the last known location.

Without these permissions, only country level location information will be available.

You may call FlurryAgent.setLocation() to set the location manually if your app uses the GPS.

To disable detailed location reporting even when your app has permission, call FlurryAgent.setReportLocation(false) before calling FlurryAgent.onStartSession()

android.permission.ACCESS_COARSE_LOCATION or
android.permission.ACCESS_FINE_LOCATION

If your application has location android.permission.ACCESS_FINE_LOCATION permission, analytics will use PASSIVE_PROVIDER to get the location information. Otherwise it will use the NETWORK_PROVIDER to fetch the last known location.

Without these permissions, only country level location information will be available.

You may call FlurryAgent.setLocation() to set the location manually if your app uses the GPS. To disable detailed location reporting even when your app has permission, call FlurryAgent.setReportLocation(false) before calling FlurryAgent.onStartSession().

Specify a versionName attribute in the manifest to have data reported under that version name.

Application

If you are shipping an app, extend the Application class if you are not already doing so:

application
  android:name=".MyApplication">
  …
</application>

Configure Your Proguard.cfg File (Optional)

The following step is only necessary if you are using Proguard to obfuscate your code.

Add the following instructions to your proguard.cfg file:

# Required to preserve the Flurry SDK
-keep class com.flurry.** { *; }
-dontwarn com.flurry.**
-keepattributes *Annotation*,EnclosingMethod,Signature
-keepclasseswithmembers class * {
   public <init>(android.content.Context, android.util.AttributeSet, int);
 }

 # Google Play Services library
  -keep class * extends java.util.ListResourceBundle {
   protected Object[ ][ ] getContents();
}

 -keep public class com.google.android.gms.common.internal.safeparcel.SafeParcelable {
  public static final *** NULL;
 }

 -keepnames @com.google.android.gms.common.annotation.KeepName class *
 -keepclassmembernames class * {
    @com.google.android.gms.common.annotation.KeepName *;
  }

 -keepnames class * implements android.os.Parcelable {
  public static final ** CREATOR;
 }