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.
This manual setup shouldn’t be needed and can be considered deprecated. If you’re unsure whether you need this, feel free to contact us at contact@appbrain.com and we can see how our SDK can better fit your use case.
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" />
<provider
android:name="com.appbrain.AppBrainInitProvider"
android:authorities="${applicationId}.AppBrainInitProvider"
android:exported="false" />
<service android:name="com.appbrain.AppBrainService" />
<service
android:name="com.appbrain.AppBrainJobService"
android:permission="android.permission.BIND_JOB_SERVICE" />
If you don’t use Gradle to compile your app, you will need to manually replace the ${applicationId}
with your app’s package name.
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
-dontwarn com.appbrain.**
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
.