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: 'com.android.application'
 
dependencies {
    compile 'com.android.support:appcompat-v7:22.1.1'
 
    compile "com.audienceproject:userreport:0.+"
    compile "com.google.android.gms:play-services:7.5.0+"
}
 
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="http://schemas.android.com/apk/res/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" >
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />
                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>
    </application>
</manifest>
 
3. Add UserReport to your main activity app/src/main/java/com/userreport/example/myapplication/MainActivity.java
package com.mixpanel.example.myapplication;
 
import android.os.Bundle;
import android.support.v7.app.ActionBarActivity;
 
import com.audienceproject.UserReport;
 
public class MainActivity extends ActionBarActivity {
 
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
 
        String sakId = YOUR_SAK_ID; // eg: "yourcompany" 
        String mediaId = YOUR_MEDIA_ID; // eg: "b2a408cb-719d-4468-a943-1187201d1ccb" 
        new UserReportBuilder(sakId, mediaId)
                .build(this);
    }
}

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")
    .build(this);
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 - https://helpdesk.userreport.com/hc/en-us/articles/209410186-Can-users-be-invited-more-than-one-time-
 
If UserReport decided not to invite user because of invitation frequency it will retry attempt during next application usage session.

Testing

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)
    .setSurveyTestMode()
    .build(this);

Debugging

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

Attachments

Comments

  • Avatar
    Jacob Durani

    There need to be the provided the process of installing the user report for the SDK from where it can be to the Android application which is very much important windows 10 audio crackling to get the information for the ongoing tenure.

Powered by Zendesk