Returns true if consent has been given, false otherwise.
WARNING
Please note that this only refers to whether the user has confirmed a choice and not whether they have accepted or refused their consent.
CMP display modes
There are three display modes:
The first mode is ONLY executed if user consent is required.
The second mode allows your users to view/modify their consent with direct access to layer 1 (often used from your settings screen to display your user's privacy policy) - layer 1 corresponds to the main display of your notice. The window will be displayed ALL THE TIME.
The last one is actually equivalent to the second one, except that the user has direct access to layer 2. This screen allows you to configure your different purposes/stacks in detail, as well as your partners. The window will be displayed ALL THE TIME.
NOTE
By default, this “presentNotice” method attempts to display the CMP. It attempts to do so because, depending on the region of your users, it will follow its controls and display the CMP only if necessary.
It will also be displayed if user consent has not yet been given or if it needs to be renewed.
appconsent.presentNotice() // Case 1appconsent.displayLayer1() // Case 2appconsent.displayLayer2() // Case 3
GCM Status
INFO
This method shows the current status of GCMv2 (Google Consent Mode V2).
Before calling up this method, it's best to make sure that the user has already given his consent and that it's up to date, and that the CMP doesn't need to be redisplayed.
Otherwise :
either the saved value of the old consent will be returned
or the default values of your FirebaseAnalytics AndroidManifest configuration will be returned
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.
INFO
The method will return true if you have modified the Source and/or Notice from your dashboard and, if and only if, you have configured your Notice to update for all your users.
ATTENTION
This method can only be used once within a predefined time period. 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.
IAB Purpose X Allowed
Returns true if the purpose with id = 1 is authorized, false otherwise. The id to pass is the iabId of your purpose.
IAB Purposes Allowed
Returns a list of integers representing the IDs of accepted purposes ONLY.
IAB Feature X Allowed
Returns true if the feature with id = 1 is authorized, false otherwise. The id to pass is the iabFeatureId of your feature.
IAB Features Allowed
Returns a list of integers representing the IDs of accepted features ONLY.
IAB Special Feature X Allowed
Returns true if the special feature with id = 1 is authorized, false otherwise. The id to pass is the iabSpecialFeatureId of your special feature.
IAB Special Features Allowed
Returns a list of integers representing the IDs of accepted special features ONLY.
IAB Special Purpose X Allowed
Returns true if the special purpose with id = 1 is authorized, false otherwise. The id to pass is the iabSpecialPurposeId of your special purpose.
IAB Special Purposes Allowed
Returns a list of integers representing the IDs of accepted special purposes ONLY.
Stack X Allowed
Returns true if the stack with id = 1 is authorized, false otherwise. The id to pass is the iabStackId of your stack.
IAB Stacks Allowed
Returns a list of integers representing the IDs of accepted stack ONLY.
Vendor X Allowed
Returns true if the vendor with id = 1 is authorized, false otherwise. The id to pass is the iabVendorId of your stack.
IAB Vendors Allowed
Returns a list of integers representing the IDs of accepted vendors ONLY.
Extra Vendor X Allowed
Returns true if the extra vendor with id = "abc123" is authorized, false otherwise.
Extra Vendors Allowed
Returns a list of string representing the IDs of accepted extra vendors ONLY.
Extra Purpose X Allowed
Returns true if the extra purpose with id = "abc123" is authorized, false otherwise.
Extra PurposeAllowed
Returns a list of string representing the IDs of accepted extra purpose ONLY.
Purposes list
Returns a list of all purposes in your source with the user-defined status ACConsentable.
In this example, the id is that of the purpose, the type is PURPOSE, the status is an integer in string form (see ACConsentableStatus), and additionalInfo will allow us to retrieve the latest updates from the IAB in the future if it adds any.
It's time for our SDK to offer the new entry.
Purposes list by status
Returns a list of all purposes in your source filtered by the status you pass as a parameter.
Features list
Returns a list of all features in your source with the user-defined status ACConsentable.
Features list by status
Returns a list of all features in your source filtered by the status you pass as a parameter.
Special Purpose list
Returns a list of all special features in your source with the user-defined status ACConsentable.
Special Purpose list by status
Returns a list of all special purpose in your source filtered by the status you pass as a parameter.
Special Feature list
Returns a list of all special features in your source with the user-defined status ACConsentable.
List de Special Feature par status
Returns a list of all special features in your source filtered by the status you pass as a parameter.
Extra Purpose list
Returns a list of all extra purpose in your source with the user-defined status ACConsentable.
Extra Purpose list by status
Returns a list of all extra purpose in your source filtered by the status you pass as a parameter.
Stack list
Returns a list of all stack in your source with the user-defined status ACConsentable.
Stack list par status
Returns a list of all stack in your source filtered by the status you pass as a parameter.
Extra Vendors list
Returns a list of all extra vendors in your source with the user-defined status ACExtraVendor.
Extra Vendors list by status
Returns a list of all extra vendors in your source filtered by the status you pass as a parameter.
Is the user's consent mixed?
Returns true if all user consent is mixed. That is, if some consent items have been accepted and others rejected.
Did the user accept everything?
Returns true if all consentables, stacks, and vendors are accepted. Returns false if at least one of them is not accepted.
Did the user refuse everything?
Returns true if all consentables, stacks, and vendors are rejected. Returns false if at least one of them is not rejected.
Define the status of consentable items
Define the status of the new consent and save it.
The ACConsentOverride object allows you to modify any consentable item as many times as you want in a single operation. It provides a list of consentable items to be modified, such as purposes, stacks, vendors, etc.
Each status is constructed in the following form using the ACConsentStatus object.
The latter takes the following parameters:
id: The ID of the consentable you want to modify (as a string)
status: the new status you want to “redefine” (as a boolean)
true: ALLOWED
false: DISALLOWED
legintStatus: the new legitimate status you want to “redefine” (as a boolean)
true: ALLOWED
false: DISALLOWED
onSuccess: is the callback that will be called if consent has been successfully modified and saved
onError: is the callback that will be called if an error occurred during the modification
Delete the consent
Deletes user consent locally, but not on the server (this will allow the CMP to be displayed again the next time presentNotice() is called, for example).
Define your external IDs
Allows you to set your external credentials while saving them on our servers.
Retrieve your external IDs
Retrieve your previously saved external IDs
Define your external IDs locally
Allows you to save your external credentials LOCALLY, which will be sent to the server when the user gives their consent.
Retrieve your local external IDs
Retrieve your externally saved IDs locally
Get User ID
Retrieves the user ID used for consent
Find out if the user has restricted the use of their advertising ID
true if the user ID is restricted, false otherwise
Knowing if your user is subject to consent
Returns true if your user is subject to consent, false if the user is not, null if the information is not yet known by our SDK.
Know the overall status of purposes
Allows you to quickly see the status of all purposes for your source, following user consent.
Know the overall status of stacks
Allows you to quickly see the status of all stacks for your source, following user consent.
Know the overall status of vendors
Allows you to quickly see the status of all vendors for your source, following user consent.
Know the overall status of user's consent
Provides a quick overview of the status of user consent.
Quickly see whether the user has ACCEPTED ALL, REFUSED ALL, MIXED, PENDING, or UNKNOWN.
Define user consent to REFUSE ALL
Allows you to confirm the “DECLINE ALL” action. This action behaves in the same way as if the CMP were displayed to your users and they clicked on the “decline all” button.
A new consent will be applied and saved.
Define user consent to ACCEPT ALL
Allows you to validate the “ACCEPT ALL” action. This action behaves in the same way as if the CMP were displayed to your users and they clicked on the “accept all” button.
A new consent will be applied and saved.
Save your floating purpose
If you have defined floating purposes in your source, define their identifiers and user statuses as parameters so that they are taken into account and saved.
Find out if any of your floating purposes need to be updated
If you have defined floating purposes in your source, this method will check whether the one passed as a parameter has been updated since then.
onSuccess: will return true or false depending on
Forces the saving of your external credentials
Allows you to save your external credentials on the server.
(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.
appconsent.checkForUpdate({ needToUpdate: Boolean ->
// Your Notice has been updated; you must resubmit the CMP to your users.
if (true == needToUpdate) {
/*
Allows you to locally delete the old user consent.
This step is not mandatory, but it avoids having to make another network call
to check later if the Notice has been updated,
as no consent will be present on the user's device.
*/
appConsent.clearConsent()
appConsent.presentNotice()
} else {
/*
The Notice is the same as during the last verification
(you have not made any changes since the board or
it has not been updated internally by us;
such as a vendor update, for example).
*/
}
}) { _: Throwable? ->
/*
An error has occurred
*/
}
data class ACConsentable(
override val id: String,
override val type: String,
override val status: String,
override val additionalInfo: Map<String, String>,
)
data class ACExtraVendor(
override val id: String,
override val type: String,
override val status: String,
override val additionalInfo: Map<String, String>,
)