[Android] 2. API Documentation
API
Constructor
Constructor for creating a CmpManager object
Parameters
Name | Type |
Description |
context | Context |
The context of the app |
config | CMPConfig |
The configuration object for the consent manager |
closeListener | OnCloseCallback |
The callback to be invoked when the consent layer is closed |
openListener | OnOpenCallback |
The callback to be invoked when the consent layer is opened |
cmpNotOpenedCallback | OnCMPNotOpenedCallback |
The callback to be invoked when the consent layer could not be opened |
onErrorCallback | OnErrorCallback |
The callback to be invoked when an error |
initialize
Initialize
Parameters
Name | Type | Description |
context | Context | |
appInterface | CmpLayerAppEventListenerInterface? = null |
Return
Example
initialize(context = ...,appInterface = ...)
setCallbacks
Set callbacks
Parameters
Name | Type | Description |
openListener | OnOpenCallback? | |
closeListener | OnCloseCallback? | |
cmpNotOpenedCallback | OnCMPNotOpenedCallback? | |
onErrorCallback | OnErrorCallback? | |
onCmpButtonClickedCallback | OnCmpButtonClickedCallback? |
Return
No return value
Example
setCallbacks(openListener = ...,closeListener = ...,cmpNotOpenedCallback = ...,onErrorCallback = ...,onCmpButtonClickedCallback = ...)
checkAndOpenConsentLayer
Check and open consent layer
Parameters
Name | Type | Description |
context | Context | Application Context |
appInterface | CmpLayerAppEventListenerInterface? = null |
Return
No return value
Example
checkAndOpenConsentLayer(context = ...,appInterface = ...)
openCustomLayer
opens the customized consent layer
Parameters
Name | Type | Description |
activity | FragmentActivity | instance |
containerViewId | Int |
Return
No return value
Example
openCustomLayer(activity = ...,containerViewId = ...)
check
Check
Parameters
Name | Type | Description |
context | Context | |
onCmpLayerOpenCallback | OnCmpLayerOpenCallback | |
isCached | Boolean = false |
Return
No return value
Example
check(context = ...,onCmpLayerOpenCallback = ...,isCached = ...)
openCustomLayer
opens the customized consent layer
Parameters
Name | Type | Description |
context | Context | Application Context |
appInterface | CmpLayerAppEventListenerInterface |
Return
No return value
Example
openCustomLayer(context = ...,appInterface = ...)
openConsentLayer
opens the consent layer
Return
No return value
Example
openConsentLayer()
createCustomLayerFragment
Create custom layer fragment
Return
CmpLayerFragment
Example
createCustomLayerFragment()
hasConsent
check if the user gave consent
Return
app has consent or not
Example
hasConsent()
getAllPurposes
returns all purposes as a String
Return
purpose String
Example
getAllPurposes()
getAllPurposeList
returns all purposes as a List of String
Return
purpose List
Example
getAllPurposeList()
getEnabledPurposes
Get agreed purposes
Return
Example
getEnabledPurposes()
getEnabledPurposeList
Get agreed purpose list
Return
Example
getEnabledPurposeList()
getDisabledPurposes
Get disabled purposes
Return
Example
getDisabledPurposes()
getAllVendors
Get all vendors
Return
Example
getAllVendors()
getAllVendorsList
Get all vendors list
Return
Example
getAllVendorsList()
getEnabledVendors
Get agreed vendors
Return
Example
getEnabledVendors()
getEnabledVendorList
Get agreed vendor list
Return
Example
getEnabledVendorList()
getDisabledVendors
Get disabled vendors
Return
Example
getDisabledVendors()
enableVendorList
Enable vendor list
Parameters
Name | Type | Description |
context | Context | Application Context |
vendors | List | |
onConsentReceivedCallback | OnConsentReceivedCallback? = null |
Return
No return value
Example
enableVendorList(context = ...,vendors = ...,onConsentReceivedCallback = ...)
disableVendorList
Disable vendor list
Parameters
Name | Type | Description |
context | Context | Application Context |
vendors | List | List of vendor ids to enable. |
onConsentReceivedCallback | OnConsentReceivedCallback? = null |
Return
No return value
Example
disableVendorList(context = ...,vendors = ...,onConsentReceivedCallback = ...)
enablePurposeList
Enable purpose list
Parameters
Name | Type | Description |
context | Context | Application Context |
purposes | List | List of purpose ids to enable. |
updateVendor | Boolean = true | flag if true also enable corresponding vendors |
onConsentReceivedCallback | OnConsentReceivedCallback? = null |
Return
No return value
Example
enablePurposeList(context = ...,purposes = ...,updateVendor = ...,onConsentReceivedCallback = ...)
disablePurposeList
Disable a list of purposes
Parameters
Name | Type | Description |
context | Context | Application Context |
purposes | List | List of purposes ids to disable |
updateVendor | Boolean = true | flag if true also disable corresponding vendors |
onConsentReceivedCallback | OnConsentReceivedCallback? = null |
Return
No return value
Example
disablePurposeList(context = ...,purposes = ...,updateVendor = ...,onConsentReceivedCallback = ...)
rejectAll
Rejects
Parameters
Name | Type | Description |
context | Context | Application Context |
Return
No return value
Example
rejectAll(context = ...)
acceptAll
Accept all
Parameters
Name | Type | Description |
context | Context | Application Context |
Return
No return value
Example
acceptAll(context = ...)
getUSPrivacyString
Get u s privacy string
Return
US Privacy String
Example
getUSPrivacyString()
hasVendorConsent
Has vendor consent
Parameters
Name | Type | Description |
context | Context | Application Context |
id | String | vendor id |
Return
Boolean if consent has given vendor
Example
hasVendorConsent(context = ...,id = ...)
hasPurposeConsent
Has purpose consent
Parameters
Name | Type | Description |
context | Context | Application Context |
id | String | purpose id |
isIABPurpose | Boolean | (deprecated) if purpose is an IAB Purpose |
checkConsent | Boolean = true |
Return
Example
hasPurposeConsent(context = ...,id = ...,isIABPurpose = ...,checkConsent = ...)
getGoogleACString
Get Google AC string
Return
Google AC String
Example
getGoogleACString()
getConsentstring
Get last consent string
Return
saved Consent String
Example
getConsentstring()
exportCmpString
Export consent string
Return
saved Cmp String
Example
exportCmpString()
getCalledLast
Get called last
Return
last called Cmp Layer Date
Example
getCalledLast()
calledThisDay
Called this day
Return
if layer was called today
Example
calledThisDay()
needsAcceptance
Needs acceptance
Return
if user needs Acceptance
Example
needsAcceptance()
setOpenCmpConsentToolViewListener
opens the consent layer
Parameters
Name | Type | Description |
context | Context | Application Context |
gdprButton | Button | action Button |
callback | OnCloseCallback? |
Return
No return value
Example
setOpenCmpConsentToolViewListener(context = ...,gdprButton = ...,callback = ...)
setOpenPlaceHolderViewListener
Set open place holder view listener
Parameters
Name | Type | Description |
context | Context | Application Context |
actionButton | Button |
Return
No return value
Example
setOpenPlaceHolderViewListener(context = ...,actionButton = ...)