Consent Manager (GDPR, CCPA, ATT)

1. Request Consent Info Update 


Consent manager SDK can be synchronized at any moment of the application lifecycle. We recommend to synchronize it at application launch. Multiple synchronization calls are allowed.

Required parameter is appKey - Appodeal API Key and ConsentInfoUpdateListener - listener for result request.

/// Initialisation 

ConsentManager consentManager = ConsentManager.getInstance();

consentManager.requestConsentInfoUpdate(appKey, this);

// Prevent consent manager to ask app tracking transparency permissions

After request completion, you can receive information about the previous user consent and regulation zone. Before request these parameters are undefined

// Get manager
ConsentManager consentManager = ConsentManager.getInstance();

// Get consent object for Appodeal SDK
Consent consent = consentManager.getConsent();

// Check regulation
Consent.Zone consentZone = consentManager.getConsentZone();

// Check consent status

Consent.Status consentStatus = consentManager.getConsentStatus();

// Check authorization status 
/// Enumeration of traking authorization status
/// - NOT_DETERMINED: User not gives any consent. For devices with iOS 14.0 and higher
/// - RESTRICTED: User disable tracking permission alerts. For devices with iOS 14.0 and higher
/// - DENIED: User didn't give tracking permission or LAT is enabled in older iOS versions.
/// - AUTHORIZED: User gave tracking permission or LAT is diabled in older iOS versions.
Consent.AuthorizationStatus consentAuthorizationStatus = consent.getAuthorizationStatus();
// Get consent string
String iabString = consentManager.getIabConsentString();

You can check whether to show a Consent Dialog or not. Before request these parameters are undefined

// Get manager
ConsentManager consentManager = ConsentManager.getInstance();

// Get current ShouldShow status
Consent.ShouldShow consentShouldShow = consentManager.shouldShowConsentDialog();

if (consentShouldShow == Consent.ShouldShow.TRUE){
    // show dialog


You can force consent manager to write iAB keys in SharedPreference by setting up storage property before the request to ConsentManager.Storage

SDK does not remove iAB keys from SharedPreference and only overrides them

// Store IAB strings in SharedPreference
// NOTE: should be called before request

// Get manager
ConsentManager consentManager = ConsentManager.getInstance();

// Set storage

// Get storage
ConsentManager.Storage iabStorage = consentManager.getStorage();

You can register yourself as a vendor before request. 

nameStringDisplay name. Will be displayed in the consent window
bundleString Custom string to check consent result for the vendor
policyUrlStringPolicy URL
purposeIdsArray of integersiAB purposes ids array
featureIdsArray of integersiAB features ids array
legitimateInterestPurposeIdsArray of integersiAB leg int purposes ids array
// Register custom vendor (will be displayed on consent window)
// should be called before request

// Get manager
ConsentManager consentManager = ConsentManager.getInstance();

// Create custom vendor
Vendor customVendor = new Vendor.Builder(
                    "Custom Vendor",
                .setPurposeIds(new List<int> {1, 2, 3})
                .setFeatureId(new List<int> {1, 2, 3})
                .setLegitimateInterestPurposeIds(new List<int> {1, 2, 3})

// Set custom vendor

// Get by bundle

2. Show Consent window

SDK allows calling consent window API only after request 

After the SDK requests, you can build and load the consent window. Loading allowed in any regulation zone and independent from previous consent.

ConsentForm consentForm = new ConsentForm.Builder().withListener(this).build();

You can check that the consent window is ready or not

// Indicates that consent window ready to present
boolean loaded = consentForm.isLoaded();

You can check that the consent window is showing or not

// Indicates that consent window is showing
boolean showing = consentForm.isShowing();

After consent window Is ready you can show it as Activity or Dialog

// Show consent dialog as Activity

// Show consent dialog as Dialog

Handling presentation callbacks

#region ConsentFormListener

public void onConsentFormLoaded() { print("ConsentFormListener - onConsentFormLoaded");}

public void onConsentFormError(ConsentManagerException exception) { print($"ConsentFormListener - onConsentFormError, reason - {exception.getReason()}");}

public void onConsentFormOpened() { print("ConsentFormListener - onConsentFormOpened");}

public void onConsentFormClosed(Consent consent) { print($"ConsentFormListener - onConsentFormClosed, consentStatus - {consent.getStatus()}");}


3. Error handling

All returned errors are Exception instances with custom codes:

INTERNAL(1)Error on the SDK side. Includes JS-bridge or encoding/decoding errors
NETWORKING(2)HTTP errors, parse request/response 
INCONSISTENT(3)Incorrect SDK API usage
#region ConsentInfoUpdateListener

public void onConsentInfoUpdated(Consent consent) { print("onConsentInfoUpdated");}

public void onFailedToUpdateConsentInfo(ConsentManagerException error) { print($"onFailedToUpdateConsentInfo Reason: {error.getReason()}");}