Skip to main content

Overview

This guide provides step-by-step instructions to install the AppTrove SDK into your Android application using Gradle. It covers adding dependencies, configuring permissions, and setting up support for Google Play, Xiaomi GetApps, and Google Advertising ID.

Installing the SDK


Install the Android SDK using your preferred method: Via Gradle, or manually.

Method 1: Install using gradle

To install the SDK, configure your Gradle files to include the Maven Central repository and the AppTrove SDK dependency.

Step 1: Declare the Maven Central Repository

In your Project-level build.gradle file, add the mavenCentral() repository:

repositories {
mavenCentral()
}
Step 2: Add the SDK Dependency

In your Module-level build.gradle file, include the AppTrove SDK dependency. Replace HERE_LATEST_VERSION with the latest version available on Maven Repository.

dependencies {
implementation 'com.trackier:android-sdk:HERE_LATEST_VERSION'
// For Example:
// implementation 'com.trackier:android-sdk:1.6.68'
}
note

Sync your project with Gradle to download the SDK.

Configure required permissions


To enable the SDK to access device information and network features, declare the required permissions in your AndroidManifest.xml file. Add the following permissions inside the <manifest> tag:

<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
package=YOUR_PACKAGE_NAME>

<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: Required for certain device information -->
<uses-permission android:name="android.permission.READ_PHONE_STATE" />

...

</manifest>
note

The READ_PHONE_STATE permission is optional and should only be included if your app requires access to specific device information.

Google Advertising ID (GAID) configuration


To comply with google play store requirements, use the Google Advertising ID (gps_adid) for device identification.

Step 1: Add the google play services ads identifier dependency

In your Module-level build.gradle file, add the following dependency:

dependencies {
implementation 'com.google.android.gms:play-services-ads-identifier:18.0.1'
}
note

Please use the latest stable version of com.google.android.gms:play-services-ads-identifier dependency.

Step 2: Add AD_ID Permission (Android 12+)

For apps targeting Android 12 or higher, include the AD_ID permission in your AndroidManifest.xml:

<uses-permission android:name="com.google.android.gms.permission.AD_ID" />
Step 3: Include google play services version Meta-Data

Add the following meta-data inside the <application> tag in your AndroidManifest.xml:

<meta-data
android:name="com.google.android.gms.version"
android:value="@integer/google_play_services_version" />

Adding store referrer libraries


The AppTrove SDK supports multiple store referrer libraries to enhance attribution accuracy. Simply add the required referrer dependency—everything else is handled automatically by the SDK.

Option 1: Google Play Install Referrer

To support attribution via the Google Play Store, integrate the Google Play Install Referrer API.

In your Module-level build.gradle file, add the following dependency:

dependencies {
implementation 'com.android.installreferrer:installreferrer:2.2'
}
note

Please use the latest stable version of com.android.installreferrer:installreferrer dependency.

Option 2: Xiaomi GetApps Store Referrer

For apps targeting the Xiaomi GetApps Store, include the Xiaomi referrer dependency in your Module-level build.gradle file:

dependencies {
implementation 'com.miui.referrer:homereferrer:1.0.0.6'
}
note

Please use the latest stable version of com.miui.referrer:homereferrer dependency.

ProGuard Configuration


If your app uses ProGuard for code optimization, add the following rules to your ProGuard configuration file (e.g., proguard-rules.pro) to prevent the removal of required classes:

-keep class com.trackier.sdk.** { *; }
-keep class com.google.android.gms.common.ConnectionResult {
int SUCCESS;
}
-keep class com.google.android.gms.ads.identifier.AdvertisingIdClient {
com.google.android.gms.ads.identifier.AdvertisingIdClient$Info getAdvertisingIdInfo(android.content.Context);
}
-keep class com.google.android.gms.ads.identifier.AdvertisingIdClient$Info {
java.lang.String getId();
boolean isLimitAdTrackingEnabled();
}
-keep public class com.android.installreferrer.** { *; }
-keep class kotlin.Metadata { *; }
-keep class kotlin.reflect.jvm.internal.** { *; }
-keep class kotlin.** { *; }
-dontwarn kotlin.**