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 (ie: in NSUserDefaults).
  • 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 set the default consent state with the following method: LRAts.shared.hasConsentForNoLegislation.
  • 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

LRAtsManager.initialize(LRAtsConfiguration("40b867f9-93cc-4687-a2c7-d02bed91aaee"),
    object : LRCompletionHandlerCallback {
        override fun invoke(success: Boolean, error: LRError?) {
            if (success) {
                // SDK ready for use
            } else {
                // SDK failed to initialize
            }
    }
})
LRAtsManager.INSTANCE.initialize(new LRAtsConfiguration("40b867f9-93cc-4687-a2c7-d02bed91aaee"), new LRCompletionHandlerCallback() {
    @Override
    public void invoke(boolean success, @Nullable LRError lrError) {
        if (success) {
            // SDK ready for use
        } else {
            // SDK failed to initialize
        }
    }
});

What’s Next

Use our APIs to work more efficiently