ConsentInformation

interface ConsentInformation


Utility methods for collecting consent from users.

Summary

Nested types

@Retention(value = SOURCE)
@IntDef(value = [ConsentStatus.UNKNOWN, ConsentStatus.NOT_REQUIRED, ConsentStatus.REQUIRED, ConsentStatus.OBTAINED])
annotation ConsentInformation.ConsentStatus

Consent status values.

Interface definition for a callback to be invoked when consent info failed to update.

Interface definition for a callback to be invoked when consent info is successfully updated.

Privacy options requirement status.

Public functions

Boolean

Indicates whether the SDK has gathered consent aligned with the app's configured messages.

Int

Gets the current consent status.

ConsentInformation.PrivacyOptionsRequirementStatus!

Gets the status indicating whether a privacy options button is required.

Boolean

Returns true if a ConsentForm is available, false otherwise.

Unit
requestConsentInfoUpdate(
    activity: Activity!,
    consentRequestParameters: ConsentRequestParameters!,
    successListener: ConsentInformation.OnConsentInfoUpdateSuccessListener!,
    failureListener: ConsentInformation.OnConsentInfoUpdateFailureListener!
)

Requests a consent information update.

Unit

Resets the ConsentInformation to initialized status.

Public functions

canRequestAds

fun canRequestAds(): Boolean

Indicates whether the SDK has gathered consent aligned with the app's configured messages.

This method returns false until requestConsentInfoUpdate is called.

Once requestConsentInfoUpdate is called, this method returns true when getConsentStatus returns NOT_REQUIRED or OBTAINED.

Returns
Boolean

true if the SDK has gathered consent aligned with the app's configured messages.

getConsentStatus

@ConsentInformation.ConsentStatus
fun getConsentStatus(): Int

Gets the current consent status.

Returns
Int

UNKNOWN until requestConsentInfoUpdate is called, and defaults to the previous session's value until requestConsentInfoUpdate completes successfully and OnConsentInfoUpdateSuccessListener is called.

getPrivacyOptionsRequirementStatus

fun getPrivacyOptionsRequirementStatus(): ConsentInformation.PrivacyOptionsRequirementStatus!

Gets the status indicating whether a privacy options button is required.

Returns
ConsentInformation.PrivacyOptionsRequirementStatus!

UNKNOWN until requestConsentInfoUpdate is called, and defaults to the previous session's value until requestConsentInfoUpdate completes successfully and is called.

isConsentFormAvailable

fun isConsentFormAvailable(): Boolean

Returns true if a ConsentForm is available, false otherwise.

requestConsentInfoUpdate

fun requestConsentInfoUpdate(
    activity: Activity!,
    consentRequestParameters: ConsentRequestParameters!,
    successListener: ConsentInformation.OnConsentInfoUpdateSuccessListener!,
    failureListener: ConsentInformation.OnConsentInfoUpdateFailureListener!
): Unit

Requests a consent information update.

This API must be called in each app session before calling getConsentStatus.

After this API is called, the getConsentStatus API return value will be updated synchronously to hold the consent state from the previous app session, if one exists.

getConsentStatus may be updated again to the up-to-date status after is called.

Parameters
activity: Activity!

The activity used to collect screen cut-outs.

consentRequestParameters: ConsentRequestParameters!

The request params.

successListener: ConsentInformation.OnConsentInfoUpdateSuccessListener!

The consent request success listener.

failureListener: ConsentInformation.OnConsentInfoUpdateFailureListener!

The consent request failure listener.

reset

fun reset(): Unit

Resets the ConsentInformation to initialized status. This should only be used for debugging.