Skip to content

Commit

Permalink
Updates the UMP example app to better handle latency.
Browse files Browse the repository at this point in the history
PiperOrigin-RevId: 688257795
  • Loading branch information
google-ima-devrel-bot authored and IMA Developer Relations committed Oct 21, 2024
1 parent 4f596ff commit e1ee570
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,8 @@ public boolean canRequestAds() {
}

// [START is_privacy_options_required]
/** Helper function to determine if GDPR consent messages are required. */
public boolean areGDPRConsentMessagesRequired() {
/** Helper function to determine if consent messages are required. */
public boolean isPrivacyOptionsRequired() {
return consentInformation.getPrivacyOptionsRequirementStatus()
== PrivacyOptionsRequirementStatus.REQUIRED;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -105,12 +105,18 @@ protected void onCreate(Bundle savedInstanceState) {
// [START add_privacy_options]
// Check ConsentInformation.getPrivacyOptionsRequirementStatus() to see the button should
// be shown or hidden.
if (consentManager.areGDPRConsentMessagesRequired()) {
if (consentManager.isPrivacyOptionsRequired()) {
privacyButton.setVisibility(View.VISIBLE);
}
// [END add_privacy_options]
// [END_EXCLUDE]
});

// To better handle latency, this sample attempts to load ads using consent
// obtained in the previous session.
if (consentManager.canRequestAds()) {
initializeImaSdk();
}
// [END can_request_ads]

privacyButton.setOnClickListener(
Expand Down

0 comments on commit e1ee570

Please sign in to comment.