Utility methods for collecting consent from users.
Nested Class Summary
@interface | ConsentInformation.ConsentStatus | Consent status values. | |
interface | ConsentInformation.OnConsentInfoUpdateFailureListener | Interface definition for a callback to be invoked when consent info failed to update. | |
interface | ConsentInformation.OnConsentInfoUpdateSuccessListener | Interface definition for a callback to be invoked when consent info is successfully updated. | |
enum | ConsentInformation.PrivacyOptionsRequirementStatus | Privacy options requirement status. |
Public Method Summary
abstract boolean |
canRequestAds()
Indicates whether the app has completed the necessary steps for gathering updated user consent.
|
abstract int |
getConsentStatus()
Gets the current consent status.
|
abstract ConsentInformation.PrivacyOptionsRequirementStatus |
getPrivacyOptionsRequirementStatus()
Gets the status indicating whether a privacy options button is required.
|
abstract boolean | |
abstract void |
requestConsentInfoUpdate(Activity activity, ConsentRequestParameters consentRequestParameters, ConsentInformation.OnConsentInfoUpdateSuccessListener successListener, ConsentInformation.OnConsentInfoUpdateFailureListener failureListener)
Requests a consent information update.
|
abstract void |
reset()
Resets the
ConsentInformation to initialized status. |
Public Methods
public abstract boolean canRequestAds ()
Indicates whether the app has completed the necessary steps for gathering updated user consent.
This method returns false
until requestConsentInfoUpdate(Activity, ConsentRequestParameters, ConsentInformation.OnConsentInfoUpdateSuccessListener, ConsentInformation.OnConsentInfoUpdateFailureListener)
is called.
Once requestConsentInfoUpdate(Activity, ConsentRequestParameters, ConsentInformation.OnConsentInfoUpdateSuccessListener, ConsentInformation.OnConsentInfoUpdateFailureListener)
is called, this method returns true
when
getConsentStatus()
returns ConsentInformation.ConsentStatus.NOT_REQUIRED
or ConsentInformation.ConsentStatus.OBTAINED
.
Returns
- true if the app has completed the necessary steps for gathering updated user consent.
public abstract int getConsentStatus ()
Gets the current consent status.
Returns
ConsentInformation.ConsentStatus.UNKNOWN
untilrequestConsentInfoUpdate(Activity, ConsentRequestParameters, ConsentInformation.OnConsentInfoUpdateSuccessListener, ConsentInformation.OnConsentInfoUpdateFailureListener)
is called, and defaults to the previous session's value untilrequestConsentInfoUpdate(Activity, ConsentRequestParameters, ConsentInformation.OnConsentInfoUpdateSuccessListener, ConsentInformation.OnConsentInfoUpdateFailureListener)
completes successfully andConsentInformation.OnConsentInfoUpdateSuccessListener
is called.
public abstract ConsentInformation.PrivacyOptionsRequirementStatus getPrivacyOptionsRequirementStatus ()
Gets the status indicating whether a privacy options button is required.
Returns
ConsentInformation.PrivacyOptionsRequirementStatus.UNKNOWN
untilrequestConsentInfoUpdate(Activity, ConsentRequestParameters, ConsentInformation.OnConsentInfoUpdateSuccessListener, ConsentInformation.OnConsentInfoUpdateFailureListener)
is called, and defaults to the previous session's value untilrequestConsentInfoUpdate(Activity, ConsentRequestParameters, ConsentInformation.OnConsentInfoUpdateSuccessListener, ConsentInformation.OnConsentInfoUpdateFailureListener)
completes successfully andConsentInformation.OnConsentInfoUpdateSuccessListener
is called.
public abstract boolean isConsentFormAvailable ()
Returns true
if a ConsentForm
is available, false
otherwise.
public 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 ConsentInformation.OnConsentInfoUpdateSuccessListener
is called.
Parameters
activity | The activity used to collect screen cut-outs. |
---|---|
consentRequestParameters | The request params. |
successListener | The consent request success listener. |
failureListener | The consent request failure listener. |
public abstract void reset ()
Resets the ConsentInformation
to initialized status. This should only be used for
debugging.