- 1 Minute to read
- Print
- DarkLight
Initialization
- 1 Minute to read
- Print
- DarkLight
The webtrekkConfiguration
class is the entry point for setting up all configurations required by the Mapp Android SDK. It is mandatory to configure at least one Track ID and your Track Domain to start sending tracking requests to Mapp Intelligence.
Configuration Setup
To initialize tracking, define your configurations in the Application class to ensure they are globally available. The SDK will use the default global configuration if no additional settings are provided.
WebtrekkConfiguration Attributes
Attribute | Description |
---|---|
trackIds | Mandatory. You can specify multiple Track IDs if necessary. |
trackDomain | Mandatory. Enter your Track Domain. Note: SSL support is required for the track domain. |
Example:
trackDomain = "https://<trackingserver>"
Initialization Example
To initialize the SDK, follow the examples below in both Java and Kotlin.
First, obtain an instance of Webtrekk using Webtrekk.getInstance()
. Then, initialize it by passing the context and your Webtrekk configurations.
Java:
public class TrackConfig extends Application {
@Override
public void onCreate() {
super.onCreate();
WebtrekkConfiguration webtrekkConfigurations = new WebtrekkConfiguration.Builder(
Arrays.asList("111111111111111", "222222222222222"),
"https://your-trackdomain.com/"
).build();
Webtrekk.getInstance().init(this, webtrekkConfigurations);
}
}
Kotlin:
class SampleApplication : Application() {
override fun onCreate() {
super.onCreate()
val webtrekkConfigurations = WebtrekkConfiguration.Builder(
listOf("111111111111111", "222222222222222"),
"https://your-trackdomain.com/"
).build()
Webtrekk.getInstance().init(this, webtrekkConfigurations)
}
}
Important:
If you do not provide the required context or configurations, invoking any SDK method will throw an IllegalStateException.
Required Imports
Ensure that the following libraries are imported into your project:
Java:
import webtrekk.android.sdk.Webtrekk;
import webtrekk.android.sdk.WebtrekkConfiguration;
Kotlin:
import webtrekk.android.sdk.Webtrekk
import webtrekk.android.sdk.WebtrekkConfiguration