The Google User Messaging Platform (UMP) SDK is a privacy and messaging tool to
help you manage privacy choices. For more information, seeAbout Privacy & messaging.
Prerequisites
Android API level 21 or higher
Create a message type
Create user messages with one of theAvailable user message typesunder thePrivacy & messagingtab of your
AdMob
account. The UMP SDK attempts to display a
privacy message created from the AdMob Application ID
set in your project.
You should request an update of the user's consent information at every app
launch, usingrequestConsentInfoUpdate(). This request checks the following:
Whether consent is required. For example, consent is required for the
first time, or the previous consent decision expired.
Whether a privacy options entry point is required. Some privacy messages
require apps to allow users to modify their privacy options at any time.
Java
// Requesting an update to consent information should be called on every app launch.consentInformation.requestConsentInfoUpdate(activity,params,()->// Called when consent information is successfully updated.requestConsentError->// Called when there's an error updating consent information.
// Requesting an update to consent information should be called on every app launch.consentInformation.requestConsentInfoUpdate(activity,params,{// Called when consent information is successfully updated.},{requestConsentError->// Called when there's an error updating consent information.},)
After you have received the most up-to-date consent status, callloadAndShowConsentFormIfRequired()to load any forms required to
collect user consent. After loading, the forms present immediately.
Java
UserMessagingPlatform.loadAndShowConsentFormIfRequired(activity,formError->{// Consent gathering process is complete.});
Some privacy message forms are presented from a publisher-rendered privacy
options entry point, letting users manage their privacy options at any time.
To learn more about which message your users see at the privacy options
entry point, seeAvailable user message types.
Check if a privacy options entry point is required
After you have calledrequestConsentInfoUpdate(), checkgetPrivacyOptionsRequirementStatus()to
determine if a privacy options entry point is required for your app. If an entry
point is required, add a visible and interactable UI element to your app that
presents the privacy options form. If a privacy entry point is not required,
configure your UI element to be not visible and interactable.
Java
/** Helper variable to determine if the privacy options form is required. */publicbooleanisPrivacyOptionsRequired(){returnconsentInformation.getPrivacyOptionsRequirementStatus()==PrivacyOptionsRequirementStatus.REQUIRED;}
/** Helper variable to determine if the privacy options form is required. */valisPrivacyOptionsRequired:Booleanget()=consentInformation.privacyOptionsRequirementStatus==ConsentInformation.PrivacyOptionsRequirementStatus.REQUIRED
Before requesting ads, usecanRequestAds()to check if you've
obtained consent from the user:
Java
consentInformation.canRequestAds();
Kotlin
consentInformation.canRequestAds()
Listed are the following places to check if you can request ads while gathering
consent:
After the UMP SDK gathers consent in the current session.
Immediately after you have calledrequestConsentInfoUpdate(). The UMP SDK might
have obtained consent in the previous app session.
If an error occurs during the consent gathering process, check if you can
request ads. The UMP SDK uses the consent status from the previous app session.
Prevent redundant ad request work
As you checkcanRequestAds()after gathering consent and after callingrequestConsentInfoUpdate(), ensure your logic prevents redundant ad requests that
might result in both checks returningtrue. For example, with a boolean
variable.
Testing
If you want to test the integration in your app as you're developing, follow
these steps to programmatically register your test device. Be sure to remove the
code that sets these test device IDs before you release your app.
Check the log output for a message similar to the following example, which
shows your device ID and how to add it as a test device:
Use new ConsentDebugSettings.Builder().addTestDeviceHashedId("33BE2250B43518CCDA7DE426D04EE231") to set this as a debug device.
Copy your test device ID to your clipboard.
Modify your code to callConsentDebugSettings.Builder().TestDeviceHashedIdsand pass in
a list of your test device IDs.
Java
ConsentDebugSettingsdebugSettings=newConsentDebugSettings.Builder(this).addTestDeviceHashedId("TEST-DEVICE-HASHED-ID").build();ConsentRequestParametersparams=newConsentRequestParameters.Builder().setConsentDebugSettings(debugSettings).build();consentInformation=UserMessagingPlatform.getConsentInformation(this);// Include the ConsentRequestParameters in your consent request.consentInformation.requestConsentInfoUpdate(this,params,// ...);
Kotlin
valdebugSettings=ConsentDebugSettings.Builder(this).addTestDeviceHashedId("TEST-DEVICE-HASHED-ID").build()valparams=ConsentRequestParameters.Builder().setConsentDebugSettings(debugSettings).build()consentInformation=UserMessagingPlatform.getConsentInformation(this)// Include the ConsentRequestParameters in your consent request.consentInformation.requestConsentInfoUpdate(this,params,// ...)
Force a geography
The UMP SDK provides a way to test your app's behavior as though the device
were located in various regions, such as the EEA or UK, usingsetDebugGeography(). Note that debug settings only work on test devices.
Java
ConsentDebugSettingsdebugSettings=newConsentDebugSettings.Builder(this).setDebugGeography(ConsentDebugSettings.DebugGeography.DEBUG_GEOGRAPHY_EEA).addTestDeviceHashedId("TEST-DEVICE-HASHED-ID").build();ConsentRequestParametersparams=newConsentRequestParameters.Builder().setConsentDebugSettings(debugSettings).build();consentInformation=UserMessagingPlatform.getConsentInformation(this);// Include the ConsentRequestParameters in your consent request.consentInformation.requestConsentInfoUpdate(this,params,...);
Kotlin
valdebugSettings=ConsentDebugSettings.Builder(this).setDebugGeography(ConsentDebugSettings.DebugGeography.DEBUG_GEOGRAPHY_EEA).addTestDeviceHashedId("TEST-DEVICE-HASHED-ID").build()valparams=ConsentRequestParameters.Builder().setConsentDebugSettings(debugSettings).build()consentInformation=UserMessagingPlatform.getConsentInformation(this)// Include the ConsentRequestParameters in your consent request.consentInformation.requestConsentInfoUpdate(this,params,...)
Reset consent state
When testing your app with the UMP SDK, you might find it helpful to reset the
state of the SDK so that you can simulate a user's first install experience.
The SDK provides thereset()method to do this.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-09-04 UTC."],[[["\u003cp\u003eThe Google User Messaging Platform (UMP) SDK helps you manage user privacy choices and display relevant privacy messages within your Android app.\u003c/p\u003e\n"],["\u003cp\u003eYou need to integrate the UMP SDK into your app, add your AdMob Application ID, and request consent information from users at each app launch.\u003c/p\u003e\n"],["\u003cp\u003eIf required, the SDK will display a privacy message form to collect user consent before you can request ads.\u003c/p\u003e\n"],["\u003cp\u003eYou can implement a privacy options entry point to allow users to manage their privacy choices at any time.\u003c/p\u003e\n"],["\u003cp\u003eBefore requesting ads, ensure you've obtained consent using \u003ccode\u003ecanRequestAds()\u003c/code\u003e and handle potential errors during consent gathering.\u003c/p\u003e\n"]]],["The Google UMP SDK manages user privacy choices. Key actions include: installing the SDK via Gradle, adding the AdMob application ID to `AndroidManifest.xml`, and initializing `ConsentInformation`. At each app launch, update user consent via `requestConsentInfoUpdate()`. Load and show consent forms using `loadAndShowConsentFormIfRequired()`, or present privacy options via `showPrivacyOptionsForm()` if needed. Check `canRequestAds()` before ad requests. For testing, add device IDs and set debug geography; `reset()` the consent state when testing.\n"],null,[]]