Analytics, Getting Started - RumbleInc/Rumble-Android-SDK-Getting-Started GitHub Wiki

This document details the process of integrating the Rumble SDK with your Android application. If you have any questions, don't hesitate to email us at [email protected]

Note: Eclipse integration is not yet supported thus the following guidelines refer to android studio projects only

Here are the basic integration steps:

  1. Add Gradle commands to your project in relevant spots
  2. Set AndroidManifest.xml
  3. Initialise Analytics SDK in a custom Application inherited class
  4. In your base activity class, invoke rumble sdk with onStart/OnStop events
  5. You are set!

###Requirements and Dependencies

  • Android 2.3.1 (API Version 9) and up
  • android-support-v4.jar, r22
  • android-support-annotations.jar, r22

###Gradle Integration


In the root gradle file add the following

allprojects {
    repositories {
        ...
        maven {
            url  "http://dl.bintray.com/rumble-news/RumbleInc/"
        }
        ...
    }
}

In the application gradle file add the following

dependencies {

    compile(group: 'workspace', name: 'rumble-core', version: '1.0', ext: 'aar')
    compile(group: 'workspace', name: 'rumble-analytics', version: '1.0', ext: 'aar')

    compile 'com.mcxiaoke.volley:library:1.0.0'
    compile 'com.fasterxml.jackson.core:jackson-core:2.1.4'
    compile 'com.fasterxml.jackson.core:jackson-databind:2.1.4'
    compile 'com.octo.android.robospice:robospice:1.4.6'
    compile 'com.octo.android.robospice:robospice-spring-android:1.4.14'
    compile 'de.greenrobot:eventbus:2.4.0'
    compile 'com.android.support:appcompat-v7:22.2.0'

}

###AndroidManifest adjustments


#####Permissions

<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.GET_TASKS"/>
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />

#####Service Declare the following service:

<service
    android:name="com.octo.android.robospice.UncachedSpiceService"
    android:exported="false" />

###Application Adjustments


Create a custom application extension and in the onCreate add the following snippet

public class MyApplication extends Application {

    @Override
    public void onCreate() {
        super.onCreate();
        ...
        AnalyticsService.integrate(this, appID, isProduction);
        ...
    }

######Parameters:

  1. appID - (String) is the key of your title. to get one follow instructions at url http://xxxxx.com
  2. isProduction - (boolean) in case you have access to Rumble QA account during rump-up period, set this to false, otherwise true

###Activity Adjustments


Every activity should invoke the following in its onStop / onStart methods. Recommended approach is to implement this in your BaseActivity which all your activities extend.

    @Override
    protected void onStart() {
      ...
        AnalyticsService.start(this);
      ...
        super.onStart();
    }

    @Override
    protected void onStop() {
      ...
        AnalyticsService.stop();
      ...        
        super.onStop();
    }

###Session Timeout Adjustment


Some analytic providers support changes of session timeout programatically (Localytics, Rumble analytics). Use this method to set session timeout by providing time interval in seconds.

Default session timeout varies between analytic providers:

  • Rumble Analytics: 30 minutes
  • Google analytics: 30 minutes

Note: Rumble analytics provider consider a session as expired after XX seconds of inactivity. On the next send event action, a new session is created automatically.

    AnalyticsService.setSessionTimeoutInterval(600); //10 minutes