ConsentInformation

public 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])
public 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 methods

abstract boolean

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

abstract int

Gets the current consent status.

abstract ConsentInformation.PrivacyOptionsRequirementStatus

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

abstract boolean

Returns true if a ConsentForm is available, false otherwise.

abstract void

Requests a consent information update.

abstract void

Resets the ConsentInformation to initialized status.

Public methods

canRequestAds

abstract boolean canRequestAds()

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
abstract int getConsentStatus()

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

abstract ConsentInformation.PrivacyOptionsRequirementStatus getPrivacyOptionsRequirementStatus()

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

abstract boolean isConsentFormAvailable()

Returns true if a ConsentForm is available, false otherwise.

requestConsentInfoUpdate

abstract void requestConsentInfoUpdate(
    Activity activity,
    ConsentRequestParameters consentRequestParameters,
    ConsentInformation.OnConsentInfoUpdateSuccessListener successListener,
    ConsentInformation.OnConsentInfoUpdateFailureListener failureListener
)

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.

ConsentInformation.OnConsentInfoUpdateSuccessListener successListener

The consent request success listener.

ConsentInformation.OnConsentInfoUpdateFailureListener failureListener

The consent request failure listener.

reset

abstract void reset()

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