firebase:: gma:: ump:: ConsentInfo
#include <consent_info.h>
Consent Information class for the User Messaging Platform SDK.
Summary
The User Messaging Platform (UMP) SDK is Google’s option to handle user privacy and consent in mobile apps.
This class contains all of the methods necessary for obtaining consent from the user.
Constructors and Destructors |
|
---|---|
~ConsentInfo()
Shut down the User Messaging Platform Consent SDK.
|
Public functions |
|
---|---|
CanRequestAds()
|
bool
Indicates whether the app has completed the necessary steps for gathering updated user consent.
|
GetConsentFormStatus()
|
Consent form status.
|
GetConsentStatus()
|
The user’s consent status.
|
GetPrivacyOptionsRequirementStatus()
|
Check whether the privacy options form needs to be displayed.
|
LoadAndShowConsentFormIfRequired(FormParent parent)
|
Future< void >
Loads a consent form and immediately presents it using the given FormParent, if ConsentStatus is kConsentStatusRequired.
|
LoadAndShowConsentFormIfRequiredLastResult()
|
Future< void >
Get the Future from the most recent call to LoadAndShowConsentFormIfRequired().
|
LoadConsentForm()
|
Future< void >
Loads a consent form.
|
LoadConsentFormLastResult()
|
Future< void >
Get the Future from the most recent call to LoadConsentForm().
|
RequestConsentInfoUpdate(const ConsentRequestParameters & params)
|
Future< void >
Requests consent information update.
|
RequestConsentInfoUpdateLastResult()
|
Future< void >
Get the Future from the most recent call to RequestConsentInfoUpdate().
|
Reset()
|
void
Clears all consent state from persistent storage.
|
ShowConsentForm(FormParent parent)
|
Future< void >
Presents the full screen consent form using the given FormParent, which is defined as an Activity on Android and a UIViewController on iOS.
|
ShowConsentFormLastResult()
|
Future< void >
Get the Future from the most recent call to ShowConsentForm().
|
ShowPrivacyOptionsForm(FormParent parent)
|
Future< void >
If GetPrivacyOptionsRequirementStatus() is kPrivacyOptionsRequirementStatusRequired, presents a privacy options form from the provided FormParent, which is defined as an Activity on Android and a UIViewController on iOS.
|
ShowPrivacyOptionsFormLastResult()
|
Future< void >
Get the Future from the most recent call to ShowPrivacyOptionsForm().
|
Public static functions |
|
---|---|
GetInstance(const ::firebase::App & app, InitResult *init_result_out)
|
Initializes the User Messaging Platform Consent SDK.
|
GetInstance(JNIEnv *jni_env, jobject activity, InitResult *init_result_out)
|
Initializes the User Messaging Platform Consent SDK without Firebase for Android.
|
GetInstance(InitResult *init_result_out)
|
Initializes User Messaging Platform for iOS without Firebase.
|
Public functions
CanRequestAds
bool CanRequestAds()
Indicates whether the app has completed the necessary steps for gathering updated user consent.
Returns true if RequestConsentInfoUpdate() has been called and GetConsentStatus returns either kConsentStatusNotRequired or kConsentStatusObtained.
GetConsentFormStatus
ConsentFormStatus GetConsentFormStatus()
Consent form status.
This value defaults to kConsentFormStatusUnknown and requires a call to RequestConsentInfoUpdate() to update.
GetConsentStatus
ConsentStatus GetConsentStatus()
The user’s consent status.
This value defaults to kConsentStatusUnknown until RequestConsentInfoUpdate() is called, and defaults to the previous session’s value until RequestConsentInfoUpdate() completes.
GetPrivacyOptionsRequirementStatus
PrivacyOptionsRequirementStatus GetPrivacyOptionsRequirementStatus()
Check whether the privacy options form needs to be displayed.
This is updated by RequestConsentInfoUpdate().
LoadAndShowConsentFormIfRequired
Future< void > LoadAndShowConsentFormIfRequired( FormParent parent )
Loads a consent form and immediately presents it using the given FormParent, if ConsentStatus is kConsentStatusRequired.
The FormParent is defined as an Activity on Android and a UIViewController on iOS. The Future will be completed successfully after the user selects an option (and the form is dismissed), or if the form is not required. The Future will be completed with an error if the form fails to load or show.
GetConsentStatus() and CanRequestAds() will be updated prior to the Future being completed.
Details | |||
---|---|---|---|
Parameters |
|
LoadAndShowConsentFormIfRequiredLastResult
Future< void > LoadAndShowConsentFormIfRequiredLastResult()
Get the Future from the most recent call to LoadAndShowConsentFormIfRequired().
LoadConsentForm
Future< void > LoadConsentForm()
Loads a consent form.
Returns an error if the consent form is unavailable or cannot be loaded.
LoadConsentFormLastResult
Future< void > LoadConsentFormLastResult()
Get the Future from the most recent call to LoadConsentForm().
RequestConsentInfoUpdate
Future< void > RequestConsentInfoUpdate( const ConsentRequestParameters & params )
Requests consent information update.
Must be called in every app session before checking the user’s consent status or loading a consent form. After calling this method, GetConsentStatus() and CanRequestAds() will be updated immediately to hold the consent state from the previous app session, if one exists. GetConsentStatus() and CanRequestAds() may be updated again immediately before the returned future is completed.
RequestConsentInfoUpdateLastResult
Future< void > RequestConsentInfoUpdateLastResult()
Get the Future from the most recent call to RequestConsentInfoUpdate().
Reset
void Reset()
Clears all consent state from persistent storage.
This can be used in development to simulate a new installation.
ShowConsentForm
Future< void > ShowConsentForm( FormParent parent )
Presents the full screen consent form using the given FormParent, which is defined as an Activity on Android and a UIViewController on iOS.
The form will be dismissed and the Future will be completed after the user selects an option.
GetConsentStatus() and CanRequestAds() are updated when the returned Future is completed.
Details | |||
---|---|---|---|
Parameters |
|
ShowConsentFormLastResult
Future< void > ShowConsentFormLastResult()
Get the Future from the most recent call to ShowConsentForm().
ShowPrivacyOptionsForm
Future< void > ShowPrivacyOptionsForm( FormParent parent )
If GetPrivacyOptionsRequirementStatus() is kPrivacyOptionsRequirementStatusRequired, presents a privacy options form from the provided FormParent, which is defined as an Activity on Android and a UIViewController on iOS.
This method should only be called in response to a user input to request a privacy options form to be shown.
The future completes when the user selects an option and dismisses the form or is completed immediately with an error code if no form is presented. The privacy options form is preloaded by the SDK automatically when a form becomes available. If no form has been preloaded, the SDK will try to load one asynchronously.
Details | |||
---|---|---|---|
Parameters |
|
ShowPrivacyOptionsFormLastResult
Future< void > ShowPrivacyOptionsFormLastResult()
Get the Future from the most recent call to ShowPrivacyOptionsForm().
~ConsentInfo
~ConsentInfo()
Shut down the User Messaging Platform Consent SDK.
Public static functions
GetInstance
ConsentInfo * GetInstance( const ::firebase::App & app, InitResult *init_result_out )
Initializes the User Messaging Platform Consent SDK.
Details | |||||
---|---|---|---|---|---|
Parameters |
|
||||
Returns |
A pointer to the ConsentInfo instance if UMP was successfully initialized, nullptr otherwise. Each call to GetInstance() will return the same pointer; when you are finished using the SDK, you can delete the pointer and the UMP SDK will shut down.
|
GetInstance
ConsentInfo * GetInstance( JNIEnv *jni_env, jobject activity, InitResult *init_result_out )
Initializes the User Messaging Platform Consent SDK without Firebase for Android.
The arguments to GetInstance() are platform-specific so the caller must do something like this:
#if defined(__ANDROID__) consent_info = firebase::gma::ump::ConsentInfo::GetInstance(jni_env, activity); #else consent_info = firebase::gma::ump::GetInstance(); #endif
Details | |||||||
---|---|---|---|---|---|---|---|
Parameters |
|
||||||
Returns |
A pointer to the ConsentInfo instance if UMP was successfully initialized, nullptr otherwise. Each call to GetInstance() will return the same pointer; when you are finished using the SDK, you can delete the pointer and the UMP SDK will shut down.
|
GetInstance
ConsentInfo * GetInstance( InitResult *init_result_out )
Initializes User Messaging Platform for iOS without Firebase.
Details | |||
---|---|---|---|
Parameters |
|
||
Returns |
A pointer to the ConsentInfo instance. Each call to GetInstance() will return the same pointer; when you are finished using the SDK, you can delete the pointer, and the UMP SDK will shut down.
|