Skip to main content

Integrate SDK

SDK Version Selection

Choose your SDK version below:

  • Apptrove SDK → Recommended for all projects (Latest: v2.x.x)
  • Trackier SDK → Will be deprecated in August 2026 (v1.x.xx)

Use the tabs below to view integration code for your chosen SDK.

This guide provides step-by-step instructions to initialize the SDK in your Android application. It covers retrieving your SDK key, setting up the Application class, and configuring the SDK for different environments.


Initialization​


Step 1: Retrieve Your SDK Key​

  1. Log in to your Dashboard
  2. Select your application
  3. Navigate to SDK Integration in the dashboard
  4. Copy the SDK Key displayed


Step 2: Initialize the SDK​

We recommend initializing the SDK inside your app's global Application class. This ensures proper initialization in all scenarios, including deep linking.

2.1 Set Up the Application Class​

If your project doesn't have an Application class:

  1. Create a new class that extends Application
  2. Open your AndroidManifest.xml file
  3. Add the android:name attribute to the <application> tag:
<application
android:name=".MainApplication"
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name">

<!-- Other configuration -->
</application>

2.2 Initialize the SDK​

Add the initialization code in your Application class's onCreate() method:

Package: com.apptrove.sdk.*

import com.apptrove.sdk.AppTroveSDK;
import com.apptrove.sdk.AppTroveSDKConfig;

public class MainApplication extends Application {
@Override
public void onCreate() {
super.onCreate();

final String SDK_KEY = "XXXXXXX-XXXX-XXXX-80e3-5938fadff"; // Your SDK key

AppTroveSDKConfig sdkConfig = new AppTroveSDKConfig(
this, // Application context
SDK_KEY, // Your Apptrove SDK key
"development" // Environment: "development", "testing", or "production"
);

sdkConfig.setAndroidId("User Android Id"); // Optional

AppTroveSDK.initialize(sdkConfig);
}
}
important

Using the wrong SDK key will impact all traffic sent from the SDK and cause attribution/reporting issues.


Step 3: Configure for Production​

When ready to release your app:

  1. Change the environment parameter to "production"
  2. Update your log level as needed

Java:

AppTroveSDKConfig sdkConfig = new AppTroveSDKConfig(this, SDK_KEY, "production");

Kotlin:

val sdkConfig = AppTroveSDKConfig(this, SDK_KEY, "production")

Next Steps​

After completing the initialization:

  1. Verify your integration by checking for incoming events in the dashboard
  2. Implement event tracking as needed (refer to the [Event Tracking Guide])
  3. For assistance, contact support at support@apptrove.com

For complete documentation, visit the Developer Portal.