You will find the step to add Trackier SDK in your app


1. Add the SDK to your App


1.1 Add the SDK to your project using Gradle


1.1.1 Add the code below to Module-level /app/build.gradle before dependencies:
repositories { 

  mavenCentral()


1.1.2 Add the latest version of Trackier SDK as a dependency. You can find the latest version here.

dependencies {

//make sure to use the latest SDK version: https://mvnrepository.com/artifact/com.trackier/af-android-sdk

    implementation 'com.trackier:android-sdk:1.0.0'

  • }

1.2 Sync the project to retrieve the dependencies - see the following screenshot:




2. Adding Android install referrer to your app



2.1. Add the Android Install Referrer as a dependency. You can find the latest version here


If you are using ProGuard and want to use Google's new referrer API, set the following ProGuard rule: -keep public class com.android.installreferrer.** { *; }



2.2  Set required permissions



Add Required Permissions

Add the following permissions to AndroidManifest.xml:

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

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

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



3. Implement And Initialize The SDK



3.1 Retrieve your dev key


To retrieve your dev key:

  • * Go to your app's dashboard.

  • * In the dashboard, under Profile click Api Token.

  • * Copy your dev key.

3.2 Initialize the SDK


We recommend initializing the SDK inside the app's global application class. This allows the SDK to initialize in all scenarios, including deep linking.

The steps listed below take place inside the app's global application class.

Inside the app's global class, import the following libraries

import android.app.Application;

import android.util.Log;

import com.cloudstuff.trackiersdk.TrackierSDK;

import com.cloudstuff.trackiersdk.TrackierSDKConfig;


Inside the global class, assign your dev key to a variable, preferably named AF_DEV_KEY. 

JAVA:-

public class AFApplication extends Application {

    private static final String AF_DEV_KEY = "c814db62-c196-4505-bc8b-46fa8e37f688";

    //….   

}

KOTLIN:-

class AFApplication : Application() {

    private val AF_DEV_KEY = "c814db62-c196-4505-bc8b-46fa8e37f688";

    //...    

}

  • Inside the global class, after the call to super.onCreate(), initialize the TrackierSDK. See code below in the below step.

  •  

  •  

  • Inside the global class, after the super.onCreate(), initialize the SDK. 

JAVA:-

TrackierSDKConfig  sdkConfig = new   TrackierSDKConfig(this,AF_DEV_KEY,"test");

TrackierSDK.initialize(sdkConfig);