Android SDK API Reference
Last updated: October 8, 2026
This page covers the integration surface of com.cybexo:android-sdk:2.0.1. Import com.cybexo.cmp.CybexoCMP. See the setup guide for published CYB App configuration, Firebase defaults and attribution startup ordering.
Initialization
Section titled “Initialization”CybexoCMP.initialize(activity, "CYB-abcdefghij") { val status = CybexoCMP.initializationStatus val error = CybexoCMP.initializationError}Initialize from an Activity. READY means the configuration and applicable consent flow are ready; it does not mean consent was granted. Inspect initializationError when initialization fails. Use one CMP owner per application and keep optional processing disabled until the required choices permit it.
Privacy controls
Section titled “Privacy controls”CybexoCMP.forceShowBanner(activity)Expose this through the app’s persistent Privacy choices entry. It opens the applicable TCF, Google-only or regional privacy flow. Use the normal screen for granular choices and withdrawal. Back or close without Save does not commit a draft.
For a custom, visible consent control, the explicit result APIs are:
CybexoCMP.acceptAllSelectionsWithResult(activity) { saved -> /* Local result */ }CybexoCMP.rejectAllSelectionsWithResult(activity) { saved -> /* Local result */ }Call them only in response to the corresponding user action. true means the choice was saved locally, not that a server or recipient acknowledged it. Older no-result callbacks remain available for compatibility. Do not interpret those callbacks as successful storage or delivery.
Read and observe consent
Section titled “Read and observe consent”val snapshot = CybexoCMP.getConsentSnapshot()val listener: (org.json.JSONObject) -> Unit = { current -> // Read current values; marshal to the UI thread if updating views.}CybexoCMP.addConsentSnapshotListener(listener)// On teardown:CybexoCMP.removeConsentSnapshotListener(listener)Snapshot reads create neither a decision nor a receipt. Useful fields include:
| Field | Meaning |
|---|---|
initializationStatus, error |
Current initialization outcome |
settingsId, configurationVersion |
Active published App context |
decisionMade, analyticsChoice |
Valid decision presence and requested Analytics choice |
framework, nativeConsentFramework |
Active flow and configured Android framework |
gdprApplies |
Actual jurisdiction decision, or null when unknown |
tcString |
Current valid TC string; null for non-TCF flows |
google |
Four effective Google consent values |
firebaseDelivery, aapDelivery |
Separate recipient API-call outcomes |
receiptDelivery, receiptQueueDelivery |
Local receipt and queued transport diagnostics |
APPLIED means a recipient API returned normally; it may represent a pre-initialization queue. It does not prove remote reception. Disabled, absent, unsupported, failed and unknown-jurisdiction outcomes must not be presented as successful delivery.
CybexoCMP.retryConsentReceipts(context)This retries already durable receipt entries with their original identity and payload. An UNSAVED receipt was not placed in that queue and cannot be recovered by retrying it. Preserve the error when reviewing delivery.
Native TCF contract
Section titled “Native TCF contract”The SDK publishes the standard Android IABTCF_ preferences in the application’s default SharedPreferences. It includes the TC string and parsed CMP, policy, jurisdiction, purpose, vendor, legitimate-interest, special-feature and disclosed-vendor values. Do not overwrite them or use a private SDK preferences file as the vendor contract.
CybexoCMP.getTCString(context) returns the current stored TC value where applicable. Use the validated snapshot for the active flow; a nonempty arbitrary string is not permission to enable processing. Google-only mode disables TCF inference and does not create a TC string.
Owned WebView bridge
Section titled “Owned WebView bridge”Attach on the UI thread before loading an HTTPS document you control. Use an exact origin without a wildcard or path:
import com.cybexo.cmp.CybexoWebViewBridge
val bridge = CybexoWebViewBridge.attach( activity, webView, "CYB-abcdefghij", setOf("https://privacy.example.com"), allowConsentChanges = false)// On the UI thread before destroying the WebView:bridge.close()The installed Android System WebView must support WEB_MESSAGE_LISTENER. The host must also restrict navigation and provide safe content and an appropriate Content Security Policy. Only the main frame on an allowed origin receives the transport.
The owned page can request current state:
cybexoNativeConsent.onmessage = (event) => { const message = JSON.parse(event.data); if (message.state) renderPrivacyState(message.state);};cybexoNativeConsent.postMessage(JSON.stringify({ id: "read_1", command: "getSnapshot"}));Responses include type, id, accepted, error and state; native changes use type: "consentChanged". An App mismatch returns no other App’s state. This bridge shares native choices; it is not a general __tcfapi implementation and does not load Web tags.
Enable allowConsentChanges only for a trusted, visible privacy interface. Its commands are showPreferences, acceptAll, rejectAll and applyTC. applyTC requires tcString and a Boolean analyticsChoice, is validated against the current TCF context, and is rejected in Google-only mode. Use a unique ID for every real user action. Repeated action IDs are rejected; a bridge accepts up to 128 mutating requests during its lifetime. Passive reads do not consume that limit.