3. Call the APIs

This page guides you through the Mobile SDK APIs you can utilize to help you retrieve envelopes more efficiently.

You can also check the envelope settings in Console to see the refresh time, enable logging mode, and others. See our Console documentation on Implementing ATS Mobile SDK to learn more.

📘

Need help with ATS Mobile SDK? Contact [email protected] to talk to a LiveRamp representative.

Methods

getEnvelope

This method returns an envelope for the specified identifier. Phone numbers as identifiers are only supported in the U.S.

To retrieve a valid envelope, your ATS placement must be in an approved state. If the placement is unapproved, 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.

❗️

LRCustomIdentifier not available for all publishers

Due to the complexity of the custom ID mapping process, LRCustomIdentifier is only available for selected publishers who must go through an extensive onboarding process. Please note that you cannot use this API out-of-the-box.

Parameters

NameTypeDescription
idLREmailIdentifier
LREmailIdentifier(email: String)
LREmailIdentifier(sha1: String?, sha256: String?, md5: String?)

LRPhoneIdentifier (U.S. only)
LRPhoneIdentifier(phoneNumber: String)
LRPhoneIdentifier(sha1: String)

LRCustomIdentifier (Not available for all publishers)
LRCustomIdentifier(customId: String)
Non-hashed or hashed identifier for which you are requesting envelope.
callbackLREnvelopeCallback
fun invoke(envelope: Envelope?, error: LRError?)
Instance of a callback which returns the result.

Returns
No return parameter

Example

LRAtsManager.getEnvelope(
    LREmailIdentifier("[email protected]"),
    object : LREnvelopeCallback {
        override fun invoke(envelope: Envelope?, error: LRError?) {
            logD("getEnvelopeAPI: ${envelope?.envelope}")
        }
})
LRAtsManager.INSTANCE.getEnvelope(new LREmailIdentifier("[email protected]"), new LREnvelopeCallback() {
    @Override
    public void invoke(@Nullable Envelope envelope, @Nullable LRError lrError) {
        Log.d("Here's your envelope! ", envelope.getEnvelope());
    }
});

getSdkStatus

This method returns the current SDK state.

Returns
SDK status.

setAtsManagerCallback

This method sets callback for ATS Manager that is used for receiving events.

Parameter

NameTypeDescription
eventsCallbackLRAtsManagerCallbackThe instance of callback used for event delegation.

Returns
No return parameter.

removeAtsManagerCallback

This method removes callback for ATS Manager that is used for receiving events.

Parameters
No parameter

Returns
No return parameter

isDisabled

This property is used to control the status of the SDK. When set to ​true​​, the SDK becomes disabled. As a result, the APIs will not function and API calls will not be possible. Setting the property to ​false​ changes the SDK status to ​notInitialized​​ and re-initialization is required before API calls can be made again.

The default value is false.

Parameter

NameTypeDescription
sdkDisableBooleanFlag used for disabling or enabling SDK.

Returns
No return parameter

resetSdk

This method resets SDK to its initial state.

Parameters
No parameter

Returns
No return parameter

getSdkVersion

This method returns current version of the SDK.

Parameter
No parameter

Returns
String

setHasConsentForNoLegislation

This method allows you to set consent flags for countries outside of EU and U.S. that are configured in Console.

Parameter

NameTypeDescription
hasConsentForNoLegislationBooleanEdit consent if the country is not subject to GDPR/CCPA.

Returns
No return parameter

hasConsentForNoLegislation

This method returns a consent flag for countries outside of the U.S. and EU that are configured in Console for the ATS placement. If the value is true, SDK will proceed without checking for consent.

The default value is false.

To set the value to true, refer to setHasConsentForNoLegislation.

Parameter
No parameter

Returns
Boolean

Classes

LRAtsConfiguration

This class is used to configure LRAts SDK during initialization.

Property NameTypeDefaultDescription
configurationIdString/Configuration ID obtained from LiveRamp Console.
isTestModeBooleanfalseIf set to true, test mode will be enabled, in which test data is returned instead of real data from the backend. See Test Mode for more information.
logToFileEnabledBooleanfalseIf set to true, all log levels will be logged to the file in /files/logs directory in the app's sandbox.

What’s Next

Learn about the events exposed by the SDK