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. Note that phone numbers need to be normalized before passing to the SDK.

To retrieve a valid envelope, your ATS placement must already be approved. 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
LRPhoneIdentifier(phoneNumber: String)
LRPhoneIdentifier(sha1: String)

LREnvelopeIdentifier
LREnvelopeIdentifier(envelope: String)

LRCustomIdentifier (Not available for all publishers)
LRCustomIdentifier(customId: String)
Non-hashed or hashed identifier for which you are requesting envelope.

Phone numbers must be normalized before passing to the SDK. See Phone Number Normalizations.
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());
    }
});

📘

You can verify if an envelope has been successfully fetched by using a network HTTP proxy tool (such as Charles), and filter for the api.rlcdn call.

getDealIDs

🚧

This Method is Only Available in Closed Beta

ATS On-device is only available in closed beta and their methods will not work out-of-the-box.

If you want to be part of the closed beta release, contact your LiveRamp administrator to get ATS On-device enabled.

This method returns a list of Deal IDs and Deal ID status for the specified email. To retrieve valid Deal IDs, your ATS placement must already be approved. 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.

An Integration Key generated in Console is required to retrieve a Deal ID for active deals.

Parameters

NameTypeDescription
idLRDealIdentifier
LRDealIdentifier(email: String)
LRDealIdentifier(sha256: String)
Non-hashed or SHA256-hashed email for which you are requesting a list of Deal IDs.
callbackLRDealIDCallback
fun invoke(dealIDResult: DealIDResult?, error: LRError?)
Instance of callback which returns the result.

Returns

No return parameter

syncFilters

🚧

This Method is Only Available in Closed Beta

ATS On-device is only available in closed beta and their methods will not work out-of-the-box.

If you want to be part of the closed beta release, contact your LiveRamp administrator to get ATS On-device enabled.

This method starts the synchronization process of the library and updates the data used for generating Deal IDs.

Parameters

NameTypeDescription
callbackLRBloomFilterSyncCallback
fun invoke(status: BloomFilterSyncStatus?, error: LRError?)
instance of callback which returns the result.

Returns

No return parameter

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 and GPP/CCPA.

Returns
No return parameter

hasConsentForNoLegislation

This method returns a consent flag for countries outside of the U.S. and UK/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

getSdkStatus

This method returns the current SDK state.

Returns
SDK status.

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

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

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

Classes

LRAtsConfiguration

This class is used to configure LRAts SDK during initialization.

Property NameTypeDefaultDescription
configIdString/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.
apiKeyStringnullRefers to Integration Key generated through Console which is required to enable ATS On-Device.
Keep this parameter empty if you are not running ATS On-device.

LRAtsConfiguration object can be instantiated using one of the following constructors.

Using a constructor that accepts configID as a string:

LRAtsConfiguration(configID: String)

Using a constructor that accepts configID and apiKeyas strings:

LRAtsConfiguration(configID: String, apiKey: String?)

Using a constructor that accepts configID and apiKey as strings, and isTestMode and logToFileEnabled as boolean values:

LRAtsConfiguration(configID: String, apiKey: String?, isTestMode: Boolean, logToFileEnabled: Boolean)

Envelope

This class used to return envelopes for the specified identifier.

Property NameTypeDefaultDescription
envelopeStringnullLiveRamp identity envelope for the specified identifier.
envelope24StringnullMeta-scoped envelope for the specified identifier (if Meta Conversions API is enabled).
envelope25StringnullPAIR envelope for the specified identifier (if Google PAIR integration is enabled).
envelope26StringnullATS Direct envelope for specified identifier.
pairSegmentsList<String>nullBase64-decoded segments from envelope25.
atsDirectSegmentsList<String>nullBase64-decoded segments from envelope26.

What’s Next

Learn about the events exposed by the SDK