π In order for us to provide optimal support, we would kindly ask you to submit any issues to [email protected]
When submitting an issue please specify your AppsFlyer sign-up (account) email , your app ID , production steps, logs, code snippets and any additional relevant information.
- Create a dashboard for your app
- Adding the SDK to your project
- Initializing the SDK
- Getting started with Deeplinking
- SDK Guides
- API
- Sample App
- Known issues with integrating the SDK
- Testing installs
If your app does not have a AppsFlyer
dashboard your will need to Add a new app.
- Add the code below to Module-level
/app/build.gradle
beforedependencies
repositories {
mavenCentral()
}
- Add the latest version of AppsFlyer SDK as a dependency.
It is highly reccomeneded to also add the install referrer library.
implementation 'com.appsflyer:af-android-sdk:5.+'
implementation 'com.android.installreferrer:installreferrer:1.0'
- Download the AF-Android-SDK.jar
- Add it to your project
Add the following persmissions to your AndroidManifest.xml file.
The permissions should be added outside of the <application>
tag.
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
<!-- Optional : -->
<uses-permission android:name="android.permission.READ_PHONE_STATE" />
It is highly reccomended to init the SDK in a Application class.
This will prevent the SDK from being destroyed thoughout the lifecycle of the app.
Important: You must insert your apps dev key. It is required for all apps.
If you do not already have a Application
level class then you will need to create one. To do this, in the same folder as your MainActivity.java
, create a new Java class. (in this example the class is called AFApplication.java
).
import android.app.Application;
import android.util.Log;
import com.appsflyer.AppsFlyerConversionListener;
import com.appsflyer.AppsFlyerLib;
import com.appsflyer.AppsFlyerLibCore;
import java.util.Map;
public class AFApplication extends Application {
private static final String AF_DEV_KEY = "Q2aM**********HJ56";
@Override
public void onCreate() {
super.onCreate();
AppsFlyerConversionListener conversionListener = new AppsFlyerConversionListener() {
@Override
public void onConversionDataSuccess(Map<String, Object> conversionData) {
for (String attrName : conversionData.keySet()) {
Log.d(AppsFlyerLibCore.LOG_TAG, "attribute: " + attrName + " = " + conversionData.get(attrName));
}
}
@Override
public void onConversionDataFail(String s) {
}
@Override
public void onAppOpenAttribution(Map<String, String> map) {
}
@Override
public void onAttributionFailure(String s) {
}
};
AppsFlyerLib.getInstance().init(AF_DEV_KEY, conversionListener, getApplicationContext());
AppsFlyerLib.getInstance().startTracking(this);
}
}
...
Great installation and setup guides can be viewed here.
See the full API here.
Check out the sample app page here.
...
To test the AppsFlyer SDK follow these steps:
- Whitelist your test device.
- Simulating a non-organic install:
a. Make sure your device is whitelisted.
b. Generate a AppsFlyer tracking link.
c. Uninstall the app from the device.
d. Click on the link on the device.
e. Install the app.
f. You should see a non-organic install on your dashboard.