2. Initialize Android SDK

Once our SDK has been added to your project, you need to initialize it. The initialization process will run in a background thread and prepare the SDK for interactions with the user and your application.

SDK initialization requires a Configuration ID which is generated in Console. To learn how to obtain this, see Implementing ATS Mobile SDK.

Consent Requirements

The SDK will automatically perform a geolocation check to ensure consent is properly set for GDPR and CCPA. Learn what this means for your application below:

  • To successfully initialize and use the SDK, user consent needs to be present per IAB standards.
  • The SDK will fail to initialize if there is no consent given for TCF purposes 1 to 10 and if LiveRamp is not listed as a vendor (ID 97).
  • If you are running the SDK outside of the GDPR and CCPA legislations, you can command the SDK to proceed with the following API: setHasConsentForNoLegislation(hasConsentForNoLegislation: Boolean).
  • Dynamic TCF and CCPA consent monitoring and handling is applied. This ensures if consent is revoked, SDK will reset (clear cached data) and all SDK-related APIs will stop working. The SDK will automatically re-initialise and APIs will work again if consent is given during lifecycle of the application.

Learn more about consent requirements and best practices for each region during initialization.

How to Initialize ATS Mobile SDK

Follow the step-by-step guide below to learn how you can initialize ATS Mobile SDK.

1. Add permission to manifest

<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>

2. Initialize SDK

🚧

The ATS Mobile SDK only supports Kotlin v1.6.0 and above.

During this step, you will need to provide the Config ID you've previously obtained from Console. You can also use a Config ID that is linked to an unapproved ATS placement for testing purposes.

To use the ATS On-device functionality, you are also required to provide the Integration Key from Console as apiKey

LRAtsManager.initialize(
    LRAtsConfiguration(
        configurationId = "40b867f9-93cc-4687-a2c7-d02bed91aaee",
        isTestMode = false,
        logToFileEnabled = false,
        apiKey = ""
    )
) { success, error ->
    if (success) {
        // SDK ready for use
    } else {
        // SDK failed to initialize
    }
}
LRAtsManager.INSTANCE.initialize(new LRAtsConfiguration("40b867f9-93cc-4687-a2c7-d02bed91aaee", false, false, ""), (success, lrError) -> {
    if (success) {
        // SDK ready for use
    } else {
        // SDK failed to initialize
    }
});

🚧

Java Projects Initialization

Since Java doesn’t support default parameter values, to successfully initialize SDK in Java projects you have to pass all the LRAtsConfiguration parameters.

📘

Init with Unapproved ATS Placement

After the initialization process is complete, if the ATS placement tied to the Config ID is still not yet approved, the SDK will return fake data which should only be used for testing. Information regarding the placement status can be found in the log output of the SDK.


What’s Next

Use our APIs to work more efficiently