AppSurfer's Android SDK makes it easy for you to integrate AppSurfer into your Android apps.
- Add AppSurfer maven repository to your applications build.gradle.
repositories {
...
maven { url 'http://maven.appsurfer.com'}
}
- And then add AppSurfer SDK as dependency.
dependencies {
compile "com.appsurfer.android:sdk:1.0.+"
}
Important
We are using Android Build Tool version : 23.0.1, Min SDK Version : 16, Target SDK version 23 and Compile SDK version 23.
Check your build.gradle for the project and module to check if you are on the build tool version >= 23.0.1.
In AndroidManifest.xml of your application project add the following permission (if it's already not there).
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE"/>
<!-- Required for application that uses location -->
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/>
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION"/>
/**
* For initializing AppSurfer SDK
*
* @param application Current {@link Application} instance
* @param registrationId registration id
*/
Appsurfer.init(application, registrationId);
We do not store any reference to
application
parameter, so there is no possibility of cyclic reference. We just store theApplicationContext
which will be used for starting new activities.
AppSurferApp app = new AppSurferApp(packageName);
app.addParam(key, value)
ASLaunchRequest request = AppSurfer.launch(app);
request.setUser(email, mobile)
request.execute(new ASLaunchStatusListener() {
/**
* Called when application launch is successful
*/
void onSuccess(){
}
/**
* Called when application launch is unsuccessful
*
* @param throwable reason of the exception. Use throwable.getMessage() to show user readable error
*/
void onError(final Throwable throwable){
}
});