Set up the SDK
The justtrack SDK offers extensive tracking capabilities for attribution, events, and various other functionalities within your Android application. In this guide, you'll learn to:
Add the justtrack SDK to your app
Copy your API token
Instantiate a
JustTrackSdk
objectShutdown the SDK instance
Add the SDK
In your project-level build.gradle
, add the following repository to allprojects
:
Then, in your module-level build.gradle
, add the following dependency to your dependencies
:
Copy your API Token
Before integrating the justtrack SDK into your app, you need to obtain an API token. Follow these steps to get an API token:
Go to the justtrack dashboard and log in.
Navigate to your app.
Locate the API token for your app. It should be displayed on the dashboard page.
Copy the API token. It should be a string that looks like this:
Store your token as a constant called
JUSTTRACK_SDK_API_TOKEN
in yourBuildConfig
file:
An API token is specific for a package id and platform. If you build more than one app from one code base, you have to configure different API tokens for them.
Instantiate the SDK
In your main activity class, or the class where you want to use the SDK, create an instance variable, SDK
, for the JustTrackSdk
.
If you define your own application class, it must extend android.app.Application
.
Shutdown the SDK
When your app terminates, you need to unregister listeners and tear down session tracking.
First, in onDestroy()
, call your SDK object's shutdown()
method. Then, set the SDK to null
because it will no longer be used:
Last updated