Installing UserReport SDK to Android Application

This guide is covers implementation UserReport services in Native Android Apps and targeted to developers.
First of all you need to create Media with Android App type in UserReport interface and on installation tab you will find two configuration parameters that will be needed to configure UserReport in app code.
  • sakId this ID identify your account
  • mediaId this ID identify you app
This implementation guide assumes that media created, parameters known and sent to development team.

Adding UserReport SDK to your app

1. Add dependencies to app/build.gradle
apply plugin: ''
dependencies {
    compile ''
    compile "com.audienceproject:userreport:0.+"
    compile ""
android {
    compileSdkVersion 22
    buildToolsVersion "22.0.1"
    defaultConfig {
        applicationId "com.userreport.example.myapplication"
        minSdkVersion 21
        targetSdkVersion 22
        versionCode 1
        versionName "1.0"
2. Add permissions to app/src/main/AndroidManifest.xml
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="" package="com.mixpanel.example.myapplication" >
    <uses-permission android:name="android.permission.INTERNET" />
    <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
    <application android:allowBackup="true" android:icon="@mipmap/ic_launcher" android:label="@string/app_name" android:theme="@style/AppTheme" >
        <activity android:name=".MainActivity" android:label="@string/app_name" >
                <action android:name="android.intent.action.MAIN" />
                <category android:name="android.intent.category.LAUNCHER" />
3. Add UserReport to your main activity app/src/main/java/com/userreport/example/myapplication/
package com.mixpanel.example.myapplication;
import android.os.Bundle;
import com.audienceproject.UserReport;
public class MainActivity extends ActionBarActivity {
    protected void onCreate(Bundle savedInstanceState) {
        String sakId = YOUR_SAK_ID; // eg: "yourcompany" 
        String mediaId = YOUR_MEDIA_ID; // eg: "b2a408cb-719d-4468-a943-1187201d1ccb" 
        new UserReportBuilder(sakId, mediaId)

User identification parameters

If you want to send user identification parameter you can do it in following way:
new UserReportBuilder(ACCOUNT_ID, MEDIA_ID)
    .setUserInfo(UserIdentificationType.EmailSha256, "87924606b4131a8aceeeae8868531fbb9712aaa07a5d3a756b26ce0f5d6ca674")
Important: always send hashed email.

Invitation rules

By default, users are eligible for an invitation after spending in application X minutes and total Y screen-views. Screen view it is an activity start inside your app. When user becomes eligible for invitation in Z seconds from application session started we will check if user can be invited:
  • is Survey enabled for media?
  • Is current user not quarantined?
If answers on both questions is yes, we roll dices” to check if user should be invited based on invitation frequency selected in UserReport interface.
When invitation is shown - we put user to quarantine so he or she will be not invited again and again. Depending on what action user will perform in invitation quarantine will be different length. Here you can find detailed information on quarantine rules applied -
If UserReport decided not to invite user because of invitation frequency it will retry attempt during next application usage session.


During development very important to set test mode on. It will guarantee that pop up will appear each time when invite conditions met (X minutes and total Y screen-views). You can do it in following way 
new UserReportBuilder(ACCOUNT_ID, MEDIA_ID)


For debug purpose we recommend to implement ISurveyLogger and set it during initialization. Like this 
new UserReportBuilder(ACCOUNT_ID, MEDIA_ID)
    .setLogger(new someCustomLoggerImplementation())



Powered by Zendesk