Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Updates the UMP example app to better handle latency. #155

Merged
merged 1 commit into from
Oct 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 a privacy options entry point is 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,17 @@ 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]
});

// This sample attempts to load ads using consent obtained in the previous session.
if (consentManager.canRequestAds()) {
initializeImaSdk();
}
// [END can_request_ads]

privacyButton.setOnClickListener(
Expand All @@ -126,6 +131,11 @@ protected void onCreate(Bundle savedInstanceState) {

// [START request_ads]
private void initializeImaSdk() {
if (sdkFactory != null) {
// If the SDK is already initialized, do nothing.
return;
}

sdkFactory = ImaSdkFactory.getInstance();

adDisplayContainer =
Expand Down
Loading