The Android SDK is designed to provide an easy way for application developers to instrument their application to enable measurement and reporting in Effective Measure's audience planning dashboard. Instructions are provided for implementing the SDK with Android Studio as well as Eclipse.

Unique Browser

The unique browser identifier uses the Android id, this ID is fetched as follows:

Android ID

// fetch android id
Secure.getString(context.getContentResolver(), Secure.ANDROID_ID)

This is a 64-bit quantity that is generated and stored when the device first boots. It is reset when the device is wiped.

Sessions and Duration

The sessions (visits) and duration are maintained by the SDK. Cookies are not required to track sessions and duration, however, the methodology for calculating sessions and duration is written to mimic the cookie based metrics (e.g. there is a 1800 second inactivity timeout for sessions and duration is calculated as the time difference, in seconds, between consecutive page impressions).

Page Impressions

A page impression is recorded by the SDK every time the "getTracker()" method is called. It is the responsibility of the application developer to insert calls to "getTracker()" at the appropriate points in the application's life-cycle.

User Agent

The user agent string is automatically sent by the SDK to the Effective Measure collection servers. All data from the SDK will be reported under "Mobile" traffic segments. The user agent string is fetched as follows:

User Agent

// fetch user-agent string


In order to ensure the SDK is operating correctly, the developer may check the LOGCAT or device log for info and error messages.

 SDK Initialization

The EM SDK needs to be initialized with the following parameters, this needs to be done only once in the call to "getInstance()" (getInstance returns a singleton).

Valid Android application context
Type: android.context.Context
Status: Required

Description: Valid top level domain
Type: String
Status: Required

Description: Android application name ([a-z0-9]-) e.g. "em-survey-app" Please note: There should not be any spaces in the App Name
Status: Required

Description: Content descriptor like news,  sport,  video, etc. If not required an empty string can be used as the method argument.
Type: java.lang.String
Status:  Optional

Description: SDK Key provided by Effective Measure
Type: String
Status: Required

Description: Secure (https) measurement required
Type: Boolean
Status: Required

EM technical support with work with the application developer to ensure correct setup of the SDK parameters.

Traffic Collection

The SDK traffic is collected through the same network as EM standard browser collection. Traffic collection is done in real time, no buffering of data is performed by the SDK and if the device is offline the activity is not collected.


The traffic from the SDK will be reported in the Effective Measure audience planning dashboard. The technical support team will work with you to ensure correct reporting and attribution of application traffic.

Download Files

Android Developer - Android Studio

Add following jar in lib folder of Android application

  • emtracker-$LATEST.jar (latest version from above)
  • commons-codec-1.6.jar
  • android-async-http-1.4.6.jar
  • commons-httpclient-3.0.jar

In AndroidManifest.xml, under manifest

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

and under application

         <action android:name="android.net.conn.CONNECTIVITY_CHANGE"/>            <action android:name="android.net.wifi.WIFI_STATE_CHANGED"/>           </intent-filter>

(For example) In MainActivity.java, call em-tracker to record an impression.

// Import SDK
import em.app.tracker.EmTracker;

// Example parameter values are given below.
// These must be changed for each application.
// getInstance() returns the tracker singleton,
// getTracker() forces an impression to be recorded
// parameters:  Context con, String top_level_domain,
// String app_name, String content, String sdk_key,
// boolean isSecuremode

Eclipse With ADT

The setup for Eclipse is similar to Android Studio. The only difference being that the developer will need to add the android-async-http JAR file provided in the Downloads section above.

Shortened Link: http://emeasu.re/SDK_AND

Did this answer your question?