Dash Stats Docs

Manual setup

Note: This page is only relevant for projects that do not use Gradle, or for other reasons require manual setup. If you have already followed the Getting started or SDK setup documentation, you can skip this page.

Adding the AppBrain SDK

To manually add the AppBrain SDK JAR to your project, download it from our AppBrain SDK GitHub page. Just copy the file appbrain-applift-sdk.jar into the libs/ folder in your app’s project directory.

Android Manifest

The AppBrain SDK needs permission to access the internet. You probably have these permissions in your app already. Please make sure the following lines are in your AndroidManifest.xml outside of the <application> tag:

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

Also there are several activities and services which are required for the SDK. Please add these lines to your AndroidManifest.xml inside the <application> tag:

<!-- AppBrain SDK -->
<activity
    android:name="com.appbrain.AppBrainActivity"
    android:configChanges="keyboard|keyboardHidden|orientation|screenLayout|uiMode|screenSize|smallestScreenSize" />
<service android:name="com.appbrain.AppBrainService" />
<service
    android:name="com.appbrain.AppBrainJobService"
    android:permission="android.permission.BIND_JOB_SERVICE" />
<receiver
    android:name="com.appbrain.ReferrerReceiver"
    android:exported="true" >
    <intent-filter>
        <action android:name="com.android.vending.INSTALL_REFERRER" />
    </intent-filter>
</receiver>

ProGuard

If your app uses ProGuard to obfuscate your code before packaging it in your APK, you should use Android’s default proguard-android.txt config file, and add the following lines to your own ProGuard config file:

-keep public class com.appbrain.KeepClass
-keep public class * implements com.appbrain.KeepClass
-keepclassmembers class * implements com.appbrain.KeepClass {
    <methods>;
}
-keep class android.webkit.JavascriptInterface
-dontwarn android.webkit.JavascriptInterface

# This is only needed when you don't include the Google Play services:
-dontwarn com.google.android.gms.**

Note that if you use DexGuard instead of ProGuard, you may need to configure it so it doesn’t obfuscate the class names of AppBrainActivity and AppBrainService.