Client SDKs
Debug and Diagnostics
Inspect request, token, identity, device, and queue state for the Android SDK
The Android SDK exposes diagnostics through listeners and snapshot getters. These are intended for integration verification and troubleshooting.
Request Outcome Callback
Register a high-level request outcome callback:
AudienceLabSDK.setRequestResultCallback { success, errorMessage ->
Log.d("AudienceLab", "success=$success error=$errorMessage")
}Clear it when no longer needed:
AudienceLabSDK.clearRequestResultCallback()Request Debug Listener
Register a detailed request listener to inspect endpoint, payload, response status, and response body:
AudienceLabSDK.setRequestDebugListener { entry ->
Log.d("AudienceLab", "endpoint=${entry.endpoint}")
Log.d("AudienceLab", "request=${entry.requestBody}")
Log.d("AudienceLab", "status=${entry.responseStatusCode}")
Log.d("AudienceLab", "response=${entry.responseBody}")
}This is useful when checking /fetch-token failures, webhook retries, or API-key mismatches.
Snapshot APIs
Token State
val tokenSnapshot = AudienceLabSDK.getTokenDebugSnapshot()Useful fields include:
- whether a valid creative token is currently available
- last fetch status
- last attempt time
- retry attempt count
- next retry time
Identity State
val identitySnapshot = AudienceLabSDK.getIdentityDebugSnapshot()
val settled = AudienceLabSDK.isIdentitySettled()Useful for checking:
- whether identity collection has settled
- whether GAID, App Set ID, and Android ID are available
- masked previews of resolved identifiers
Device State
val deviceSnapshot = AudienceLabSDK.getDeviceDebugSnapshot()Useful for verifying:
- OS version
- device model/name
- timezone
- screen metrics
- graphics diagnostics collected for debug context
Queue State
val queue = AudienceLabSDK.getQueueDebugSnapshot()
val queueSize = AudienceLabSDK.getQueueSize()Useful for checking:
- which events are still queued
- each event type and payload preview
- attempt counts and next retry times
isDebugEnabled vs isDevelopmentMode
These are different controls:
isDebugEnabledcontrols SDK-local debug behaviorisDevelopmentModecontrols whether requests are sent withdev: true
Recommended initialization pattern:
AudienceLabSDK.initialize(
context = applicationContext,
apiKey = BuildConfig.AUDIENCELAB_API_KEY,
options = AudienceLabOptions(
isDebugEnabled = BuildConfig.DEBUG,
isDevelopmentMode = BuildConfig.DEBUG
)
)Sample App
The Android sample app includes request and queue log screens that surface these diagnostics on-device without the SDK shipping its own overlay UI.