2. Initialize the 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 ID, see Implementing ATS Mobile SDK.

Consent Requirements

The SDK will automatically perform a geolocation check to ensure consent is properly set for GDPR and GPP or 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 GPP/CCPA legislations, you can command the SDK to proceed with the following API: setHasConsentForNoLegislation(hasConsentForNoLegislation: Boolean).
  • Dynamic TCF and GPP/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 Best Practices.

🚧

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

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

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

❗️

apiKey Only Required for ATS On-Device

You do not have to populate the apiKey parameter unless you are running ATS On-Device to match identifiers directly on users' devices.

🚧

Test Mode Deprecation

Test mode has been deprecated from v2.9.0 and was fully removed from v3.0.0 onwards. During the deprecation phase, an alert will be returned if the value of isTestMode is set to true.

To test your workflow, we recommend that you create another placement for testing purposes. See "Create an ATS Placement" to learn how to do this.

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

LRAtsManager.INSTANCE.initialize(
    new LRAtsConfiguration(
        "40b867f9-93cc-4687-a2c7-d02bed91aaee",
        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

From v3.0.0 onwards, the SDK will not be initialised with unapproved ATS placements. To check your placement's status, log in to Console, and select Placements from the navigation menu.

If your ATS placement has not been approved yet, talk to your LiveRamp representative.


What’s Next

Use our APIs to work more efficiently