Skip to content

Commit

Permalink
Internal change
Browse files Browse the repository at this point in the history
PiperOrigin-RevId: 697616850
  • Loading branch information
Justin Malandruccolo authored and copybara-github committed Nov 18, 2024
1 parent d5b16e0 commit 0facf5f
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -84,21 +84,31 @@ public void gatherConsent(
ConsentRequestParameters params =
new ConsentRequestParameters.Builder().setConsentDebugSettings(debugSettings).build();

// [START gather_consent]
// [START request_consent_info_update]
// Requesting an update to consent information should be called on every app launch.
consentInformation.requestConsentInfoUpdate(
activity,
params,
() ->
() -> // Called when consent information is successfully updated.
// [START_EXCLUDE silent]
// [START load_and_show_consent_form]
UserMessagingPlatform.loadAndShowConsentFormIfRequired(
activity,
formError -> {
// Consent has been gathered.
// Consent gathering process has completed.
// [START_EXCLUDE silent]
onConsentGatheringCompleteListener.consentGatheringComplete(formError);
}),
requestConsentError ->
onConsentGatheringCompleteListener.consentGatheringComplete(requestConsentError));
// [END gather_consent]
// [END_EXCLUDE]
})
// [END load_and_show_consent_form]
// [END_EXCLUDE]
,
requestConsentError -> // Called when there's an error updating consent information.
// [START_EXCLUDE silent]
onConsentGatheringCompleteListener.consentGatheringComplete(requestConsentError)
// [END_EXCLUDE]
);
// [END request_consent_info_update]
}

/** Helper method to call the UMP SDK method to present the privacy options form. */
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,22 +69,30 @@ class GoogleMobileAdsConsentManager private constructor(context: Context) {

val params = ConsentRequestParameters.Builder().setConsentDebugSettings(debugSettings).build()

// [START gather_consent]
// [START request_consent_info_update]
// Requesting an update to consent information should be called on every app launch.
consentInformation.requestConsentInfoUpdate(
activity,
params,
{
// Called when consent information is successfully updated.
// [START_EXCLUDE silent]
// [START load_and_show_consent_form]
UserMessagingPlatform.loadAndShowConsentFormIfRequired(activity) { formError ->
// Consent has been gathered.
// Consent gathering process has completed.
// [START_EXCLUDE silent]
onConsentGatheringCompleteListener.consentGatheringComplete(formError)
// [END_EXCLUDE]
}
// [END load_and_show_consent_form]
},
{ requestConsentError ->
{ requestConsentError -> // Called when there's an error updating consent information.
// [START_EXCLUDE silent]
onConsentGatheringCompleteListener.consentGatheringComplete(requestConsentError)
// [END_EXCLUDE]
},
)
// [END gather_consent]
// [END request_consent_info_update]
}

/** Helper method to call the UMP SDK method to show the privacy options form. */
Expand Down

0 comments on commit 0facf5f

Please sign in to comment.