Client SDKs

API Reference

Complete API reference for the AudienceLab Android SDK

All methods are accessed through AudienceLabSDK.

Initialization

MethodDescription
initialize(context, apiKey, options)Initialize the SDK with a Context. Preferred form for persisted state and lifecycle hooks.
initialize(apiKey, options)Initialize without explicit Context. Uses in-memory state only.
init(...)Alias for initialize(...).
isInitialized()Returns Boolean — whether the SDK has been initialized.

Event Methods

MethodDescription
sendPurchaseEvent(...)Track a purchase. Sends type: "purchase" with total_purchase_value.
sendAdEvent(...)Track an ad event. Sends type: "ad" with total_ad_value.
sendCustomEvent(name, params?, dedupeKey?)Track a custom event. Sends type: "custom" with en and pr.
sendUserMetrics()Send daily retention metrics when eligible.

User Properties

MethodDescription
setUserProperty(key, value, scope)Set a wp or bp property using UserPropertyScope.
setUserProperty(key, value, isWhitelisted)Boolean overload for setting wp or bp.
unsetUserProperty(key, scope)Remove a property.
unsetUserProperty(key, isWhitelisted)Boolean overload for removing a property.
clearUserProperties(scope)Clear one property set.
clearUserProperties(isWhitelisted)Boolean overload for clearing one property set.
getWhitelistedUserProperties()Returns whitelisted property map.
getBlacklistedUserProperties()Returns blacklisted property map.

For blacklisted email and phone keys, the Android SDK automatically normalizes and SHA-256 hashes the stored value.

Identity and Diagnostics

MethodDescription
setAdvertisingIdProvider(provider)Set a GAID provider.
setAppSetIdProvider(provider)Set an App Set ID provider.
setAdvertisingId(gaid)Manually set GAID. Sent as ga.
clearAdvertisingId()Clear manual GAID.
setAppSetId(appSetId)Manually set App Set ID. Sent as asid.
clearAppSetId()Clear manual App Set ID.
setLimitAdTracking(lat)Set Limit Ad Tracking preference. Sent as lat.
isIdentitySettled()Returns whether identity resolution has settled.
getIdentityDebugSnapshot()Returns masked identity diagnostics.
getDeviceDebugSnapshot()Returns device debug diagnostics.
getTokenDebugSnapshot()Returns token/retry debug diagnostics.
getQueueDebugSnapshot()Returns queued event diagnostics.
setRequestResultCallback(callback)Register request outcome callback.
clearRequestResultCallback()Clear request outcome callback.
setRequestDebugListener(listener)Register detailed request debug listener.
clearRequestDebugListener()Clear request debug listener.

Token and Attribution

MethodReturnsDescription
getCreativeToken()String?Stored creative token from /fetch-token.

Configuration

MethodReturnsDescription
setSdkEnabled(Boolean)Master SDK toggle.
setSDKEnabled(Boolean)Alias for setSdkEnabled(Boolean).
isSdkEnabled()BooleanWhether SDK is enabled.
getIsSDKEnabled()BooleanAlias getter for SDK enabled state.
toggleMetricsCollection(Boolean)Enable/disable data collection.
isMetricsCollectionEnabled()BooleanWhether collection is enabled.
getIsMetricsCollection()BooleanAlias getter for metrics collection state.
setDebugEnabled(Boolean)Enable/disable debug mode.
isDebugEnabled()BooleanWhether debug mode is on.
getIsDebugEnabled()BooleanAlias getter for debug state.
isDevelopmentMode()BooleanCurrent backend dev mode.

Cumulative Values

MethodReturnsDescription
getTotalPurchaseValue()DoubleLifetime cumulative purchase value.
getTotalAdValue()DoubleLifetime cumulative ad revenue.

Queue

MethodReturnsDescription
getQueueSize()IntNumber of queued webhook events.

Version Info

MethodReturnsDescription
getSdkVersion()StringSDK version. Sent as sdk_version.
getAppVersion()StringApp version. Sent as app_version.
getRuntimeVersion()StringAndroid runtime version.

Webhook Envelope Fields

All events include these common fields automatically:

FieldSourceDescription
creativeTokenStored from /fetch-tokenAttribution token
sdk_type"native_android"Platform identifier
sdk_versionAuto-detectedSDK version
app_versionConfig or auto-detectedHost app version
os_systemAuto-detectede.g. "Android 14"
device_nameAuto-detectedHuman-readable device name
device_modelAuto-detectede.g. "SM-S911B"
utc_offsetAuto-detectedUTC offset in hours
gaGAID provider or manualGoogle Advertising ID
asidApp Set ID provider or manualAndroid App Set ID
aidAuto-collectedAndroid ID (hex)
latAuto-detected or manualLimit Ad Tracking preference
eidAuto-generatedEvent identifier
dkEvent API inputOptional deduplication key
created_atAuto-generatedEvent creation timestamp
wpUser propertiesWhitelisted properties
bpUser propertiesBlacklisted properties
devSDK configDevelopment mode flag