Android

Core Classes

The Android SDK is documented around listener-based integration. For consuming app developers, the primary classes are TrustArc and TASharedInstance, with TrustArcVendorConsentViewModel available as an optional ViewModel helper.

  • TrustArc - Primary interface for SDK initialization, consent UI handling, listener registration, and consent retrieval.
  • TASharedInstance - Singleton manager that stores and returns the active TrustArc instance.
  • TrustArcVendorConsentViewModel - Legacy ViewModel wrapper around stored vendor consent data; keep only as backward-compatible reference.

TrustArc Class

ConstructorDescription
TrustArc(context: Context, sdkMode: SdkMode = Standard)Creates a new TrustArc instance with the selected SDK mode.
TrustArc(context: Context, sdkMode: SdkMode = Standard, onGoogleConsent: GoogleConsentsListener)(DEPRECATED) Register Google consent callbacks via addGoogleConsentListener(...) instead.


Initialization Methods

MethodsDescriptionParametersReturn
startStarts SDK initialization with domain and optional language.domainName: String, language: String? = ""void
startStarts SDK initialization with domain, optional country override, and optional language.

(DEPRECATED)  IP-based parameter.
domainName: String, country: String?, language: String? = "", ipAddress: String? = nullvoid
start(DEPRECATED) IP-based overload.domainName: String, ipAddress: String?, language: String? = ""void
start(DEPRECATED) callback overloads that include onConsent and onInitFinish. Use listeners instead.domainName/ipAddress/country with 
onConsent: Runnable?, onInitFinish: Runnable?
void

Listener Methods

MethodsDescriptionParametersReturn
addConsentListenerRegisters consent-change listener using category payload. Register before start(...).callback: (Map<String, TAConsent>) -> Unitvoid
removeConsentListenerUnregisters a previously added consent listener.callback: (Map<String, TAConsent>) -> Unitvoid
addGoogleConsentListenerRegisters Google Consent Mode listener. Register before start(...).callback: GoogleConsentsListenervoid
addSdkInitializedListenerRegisters init-finish listener (no args overload).callback: () -> Unitvoid
addSdkInitializedListenerRegisters init-finish listener (status only overload).callback: (Boolean) -> Unitvoid
addSdkInitializedListenerRegisters init-finish listener (recommended overload with status and message).callback: (Boolean, String?) -> Unitvoid


Consent Management Methods

MethodsDescriptionParametersReturn
openCMManually opens the consent window void
openCM

Opens the consent window with Domain ID and  IP Address override


 

(DEPRECATED): No longer necessary to provide parameters. Domain, language, and IP address are already handled by the start() method.

domainName: Consent manager domain ID

ip: IP Address of a specific country to override device IP Address (Optional)

void
openCMWithLanguage

Opens consent window with specified language


 

(DEPRECATED): No longer necessary to provide parameters. Domain, language, and IP address are already handled by the start() method.

domainName: Consent manager domain ID

language: Locale to use when showing the consent manager modal (Optional)

ip: IP Address of a specific country to override device IP Address (Optional)

void

Information Retrieval and Configuration Methods

MethodsDescriptionParametersReturn
isConsentPresentReturns whether consent is stored on the device.NoneBoolean
getConsentValueReturns consent value for a tracker/domain ID.trackerId: StringString?
getTrustArcDeviceUUIDReturns the SDK-generated consent/device identifier.NoneString
getStoredConsentDataReturns raw flat vendor consent list (domain-level approach).NoneList<VendorConsent>
getConsentDataByCategoryReturns consent payload grouped by category (recommended approach).NoneMap<String, TAConsent>
isCategoryConsentedReturns consent decision for a category index in category order.categoryIndex: IntBoolean
getCategoryConsentReturns category name and consent decision for a category index.categoryIndex: IntTACategoryConsent?
getLastConsentReturns last consent update timestamp.NoneLong
getStoredConsentExpiryReturns computed consent-expiry timestamp from stored settings.NoneString?
getConsentLanguageReturns language used for consent configuration.NoneString?
getWebScriptReturns web script for web consent synchronization.NoneString?
getTcfStringReturns stored IAB TCF string.NoneString?
getGoogleConsentsReturns Google Consent Mode payload.NoneString?
getBehaviorReturns behavior (implied or expressed).NoneString?
useGdprDetectionEnables/disables automatic GDPR behavior detection.useGdprDetection: Booleanvoid
setUnifiedConsentContextSets unified consent context before start/fetch.key: Stringvoid
setUnifiedConsentIdentitySets unified identity for known user consent synchronization.userId: String, hmac: Stringvoid
fetchUnifiedConsentDataTriggers manual unified consent fetch from backend.callback: Callback<ResponseBody>void
isConsentPresentReturns whether consent is stored on the device.NoneBoolean

Debug and Testing Methods

MethodsDescriptionParametersReturn
enableDebugLogEnables/disables SDK debug logs.enabled: Booleanvoid
generateHmacAuthIdTesting-only helper to generate HMAC auth id for unified consent workflows.userId: string, key: stringString


TrustArcVendorConsentViewModel (Legacy)

TrustArcVendorConsentViewModel still exists in SDK sources but should be documented as legacy and not as the preferred integration path. Listener-based integration with addConsentListener is the current recommendation for consuming app developers.

MethodsDescriptionParametersReturn
getVendorConsentsReturns vendor consents as LiveData.NoneLiveData<List<VendorConsent>>
loadVendorConsentsManually refreshes vendor consent data.Nonevoid

TASharedInstance

MethodsDescriptionParametersReturn
initSdk(DEPRECATED) constructor-style init with listener parameter. Prefer TrustArc(context, sdkMode) then addGoogleConsentListener(...).context: Context, sdkMode: SdkMode, googleConsentListener: GoogleConsentsListenervoid
setSdkInstanceAssigns a TrustArc implementation to singleton.trustArc: TrustArcvoid
getSdkInstanceReturns the singleton TrustArc instance.NoneTrustArc
isSdkInitializedReturns true when singleton is initialized and assets are ready.NoneBoolean

VendorConsent

ClassDescription
VendorConsentData class that represents a vendor's consent status with associated domain
MethodSignatureDescription
domainStringThe domain identifier for the vendor
consentStringThe consent value ("1" for granted, "0" for denied)

IABTCFPreferences

Type definition for IAB TCF (Transparency & Consent Framework) preferences.

FieldDescription
IABTCF_PurposeOneTreatmentIndicates if Purpose One has special treatment (0 = no, 1 = yes)
IABTCF_VendorConsentsEncoded string representing vendor consents
IABTCF_enableAdvertiserConsentMode

Whether advertiser consent mode is enabled


 

Google’s latest Firebase SDK release for iOS and Android now supports TCF. To ensure proper consent handling and compatibility with the SDK, please set IABTCF_enableAdvertiserConsentMode to 1 when using TCF so Google can infer consent from the TC string.

IABTCF_PublisherCCPublisher's country code (e.g., "DE", "FR")
IABTCF_PublisherConsentEncoded string representing publisher-specific consent
IABTCF_gdprAppliesIndicates if GDPR applies (0 = no, 1 = yes)
IABTCF_SpecialFeaturesOptInsEncoded string representing special feature opt-ins
IABTCF_VendorLegitimateInterestsEncoded string representing vendor legitimate interests
IABTCF_PublisherLegitimateInterestsEncoded string representing publisher legitimate interests
IABTCF_PublisherCustomPurposesConsentsEncoded string representing publisher custom purposes consents
IABTCF_TCStringTC string containing the encoded user consent data
IABTCF_UseNonStandardTextsIndicates if non-standard text versions are used (0 = no, 1 = yes)
IABTCF_PolicyVersionIAB TCF policy version number
IABTCF_PurposeConsentsEncoded string representing purpose consents
IABTCF_PurposeLegitimateInterestsEncoded string representing purpose legitimate interests
IABTCF_CmpSdkIDCMP SDK ID
IABTCF_CmpSdkVersionCMP SDK version
IABTCF_PublisherCustomPurposesLegitimateInterestsEncoded string representing publisher custom purposes legitimate interests