Skip to content

wesfieldj/AndroidSDKTest

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

25 Commits
Β 
Β 

Repository files navigation

appsflyer_android_sdk

πŸ›  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.

Table of content

If your app does not have a AppsFlyer dashboard your will need to Add a new app.

A. Using Gradle

  1. Add the code below to Module-level /app/build.gradle before dependencies
repositories {
    mavenCentral()
}
  1. 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'

B. Manually adding the jar file

  1. Download the AF-Android-SDK.jar
  2. Add it to your project

1. AndroidManifest setup

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" />

2. Init the SDK

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:

  1. Whitelist your test device.
  2. 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.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published