Skip to main content

Integrate SDK

This guide provides step-by-step instructions to initialize the AppTrove 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 Trackier Panel
  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 AppTrove SDK

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

import com.trackier.sdk.TrackierSDK;
import com.trackier.sdk.TrackierSDKConfig;

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

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

TrackierSDKConfig sdkConfig = new TrackierSDKConfig(
this, // Application context
TR_SDK_KEY, // Your AppTrove SDK key
"development" // Environment: "development", "testing", or "production"
);

TrackierSDK.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

Example for production:

TrackierSDKConfig sdkConfig = new TrackierSDKConfig(this, TR_SDK_KEY, "production");
val sdkConfig = TrackierSDKConfig(this, TR_SDK_KEY, "production")

Next Steps

After completing the initialization:

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

For complete documentation, visit the Trackier Developer Portal.