How to use it?
How to use appConsent object?
Here is a list of the most commonly used methods
Check if user gave consent
appConsent.consentGiven()Return true if consent is given, false otherwise.
WARNING
Please note that we are only talking about whether the user has confirmed a choice and not whether he has accepted or refused consent.
Define the listener related to user consent
When the user has completed the consent process and given their consent, this "callback" informs them of this.
appConsent.setOnPresentNoticeListener(object : OnPresentNoticeListener {
override fun presentConsentGiven() {
// ...
}
override fun presentConsentError(error: Throwable?) {
// ...
}
})Remove Listener
Try to Display CMP notice
There are 2 display modes:
The first runs only if user consent is required.
The second, which should be used to allow your users to consult/modify their consent (often used from your settings screen to display your user's privacy policy)
It returns true if the CMP is displayed, false otherwise
GCM Status
Return GCMStatus
Check for update
This method allows you to check from our servers whether your Notice has been updated since it was last displayed on your user's device.

ATTENTION
This method can only be used once every 30 minutes. This allows you to force a first network call to make sure your users are up to date. The next calls to this method will use the cache of the previous response or attempt a network call if the previous one was in error.
Using AppConsent's more specific methods
Here's a list of methods that could be useful if you want to go further in tracking user consent.
Consentable allowed
Return true if consentable with id = 1 and consentableType = 0 is allowed, false otherwise. The id to pass is the iabId of your purpose and the consentableType is the type, e.g: purpose = 0 .
Stack Allowed
Return true if stack with id = 1 is allowed, false otherwise.
Vendor allowed
Return true if vendor with id = 1 is allowed, false otherwise.
All Consentables Allowed
Returns true if all consentables have been allowed false if at least one consentable is not allowed and null if no choice has yet been made (notice not yet downloaded, choice not yet made, application cache deleted, etc.).
All Consentables Disallowed
Returns true if all consentables have been disallowed false if at least one consentable is not disallowed and null if no choice has yet been made (notice not yet downloaded, choice not yet made, application cache deleted, etc.).
All Stacks Allowed
Returns true if all stacks have been accepted false if at least one stack is not accepted and null if no choice has yet been made or not present into your notice (notice not yet downloaded, choice not yet made, application cache deleted, etc.).
All Stacks Disallowed
Returns true if all stacks have been disallowed false if at least one stack is not disallowed and null if no choice has yet been made or not present into your notice (notice not yet downloaded, choice not yet made, application cache deleted, etc.).
All Vendors Allowed
Returns true if all vendors have been allowed false if at least one vendor is not allowed and null if no choice has yet been made (notice not yet downloaded, choice not yet made, application cache deleted, etc.).
All Vendors Disallowed
Returns true if all vendors have been disallowed false if at least one vendor is not disallowed and null if no choice has yet been made (notice not yet downloaded, choice not yet made, application cache deleted, etc.).
User Accept All
Returns true if all consent items, stacks and vendors are allowed. false if at least one of them is not allowed and null if no data is present yet (notice not yet downloaded, choice not yet made, application cache deleted, etc.).
User Deny All
Returns true if all consent items, stacks and vendors are disallowed. false if at least one of them is not disallowed and null if no data is present yet (notice not yet downloaded, choice not yet made, application cache deleted, etc.).
Set consentable status
Set consentables status, save it and send it to server.
Clear consents
Locally removes user consent, but not on the server (this will allow a new display of the CMP on the next call to tryToDisplayNotice(false) for example)
Set external ids
Allows to define additional Ids that will be taken into account when validating user consent.
Get external ids
Retrieves your previously registered external ids
(Bonus) Retrieve your consents
Your consents are saved in SharedPreferences of your application. To know more about keys used to save your consents, please refer to the IAB documentation.
We also provide an additional key for Google Additionnal Consent IABTCF_AddtlConsent returning a String.
Last updated