Skip to content

Commit

Permalink
Internal change
Browse files Browse the repository at this point in the history
PiperOrigin-RevId: 699162284
  • Loading branch information
Interactive Media Ads Developer Relations authored and IMA Developer Relations committed Nov 22, 2024
1 parent 434caa8 commit 1a7fb70
Showing 1 changed file with 24 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -68,16 +68,34 @@ public void gatherConsent(OnConsentGatheringCompleteListener onConsentGatheringC
.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,
() ->
UserMessagingPlatform.loadAndShowConsentFormIfRequired(
activity, onConsentGatheringCompleteListener::consentGatheringComplete),
onConsentGatheringCompleteListener::consentGatheringComplete);
// [END gather_consent]
() -> // Called when consent information is successfully updated.
// [START_EXCLUDE silent]
loadAndShowConsentFormIfRequired(activity, onConsentGatheringCompleteListener),
// [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]
}

private void loadAndShowConsentFormIfRequired(
Activity activity, OnConsentGatheringCompleteListener onConsentGatheringCompleteListener) {
// [START load_and_show_consent_form]
UserMessagingPlatform.loadAndShowConsentFormIfRequired(
activity,
formError -> {
// Consent gathering process is complete.
// [START_EXCLUDE silent]
onConsentGatheringCompleteListener.consentGatheringComplete(formError);
// [END_EXCLUDE]
});
// [END load_and_show_consent_form]
}

/** Shows a form to app users for collecting their consent. */
Expand Down

0 comments on commit 1a7fb70

Please sign in to comment.