Ads do not display at all if user does not fully consent to GDPR form

142 views
Skip to first unread message

Daniel Borreguero Cano

unread,
Dec 27, 2023, 9:08:47 PM12/27/23
to Google Mobile Ads SDK Developers
I have done all the steps in the next guide, but If the user does not consent, any ad is shown.

https://developers.google.com/admob/android/privacy

It says that if the user does not consent, automatically will display Non-personalized ads or Limited ads. But, it only shows ads when the user clicks Consent.

My code is excatly the one in the example:

public class MainActivity extends AppCompatActivity {
 
private ConsentInformation consentInformation;
 
// Use an atomic boolean to initialize the Google Mobile Ads SDK and load ads once.
 
private final AtomicBoolean isMobileAdsInitializeCalled = new AtomicBoolean(false);

 
 
@Override
 
protected void onCreate(Bundle savedInstanceState) {
   
super.onCreate(savedInstanceState);
    setContentView
(R.layout.activity_main);

   
// Create a ConsentRequestParameters object.
   
ConsentRequestParameters params = new ConsentRequestParameters
       
.Builder()
       
.build();

    consentInformation
= UserMessagingPlatform.getConsentInformation(this);
    consentInformation
.requestConsentInfoUpdate(
       
this,
        params
,
       
(OnConsentInfoUpdateSuccessListener) () -> {
         
UserMessagingPlatform.loadAndShowConsentFormIfRequired(
           
this,
           
(OnConsentFormDismissedListener) loadAndShowError -> {
             
if (loadAndShowError != null) {
               
// Consent gathering failed.
               
Log.w(TAG, String.format("%s: %s",
                    loadAndShowError
.getErrorCode(),
                    loadAndShowError
.getMessage()));
             
}

             
// Consent has been gathered.
             
if (consentInformation.canRequestAds) {
                initializeMobileAdsSdk
();
             
}

           
}
         
)
       
},
       
(OnConsentInfoUpdateFailureListener) requestConsentError -> {
         
// Consent gathering failed.
         
Log.w(TAG, String.format("%s: %s",
              requestConsentError
.getErrorCode(),
              requestConsentError
.getMessage()));
       
});
   
   
// Check if you can initialize the Google Mobile Ads SDK in parallel
   
// while checking for new consent information. Consent obtained in
   
// the previous session can be used to request ads.
   
if (consentInformation.canRequestAds) {
      initializeMobileAdsSdk
();
   
}

 
}
 
 
private void initializeMobileAdsSdk() {
   
if (isMobileAdsInitializeCalled.getAndSet(true)) {
     
return;
   
}

   
// Initialize the Google Mobile Ads SDK.
   
MobileAds.initialize(this);

   
// TODO: Request an ad.
   
// InterstitialAd.load(...);
 
}
}


Why it is not loading any ad?


Mobile Ads SDK Forum Advisor

unread,
Dec 27, 2023, 10:54:24 PM12/27/23
to daniel...@gmail.com, google-adm...@googlegroups.com

Hi Daniel,

Thank you for contacting the Mobile Ads SDK Support team.

I will check with our team regarding your query and one of my team members will reach out to you once we have an update on this. Meanwhile, your patience is highly appreciated.

 This message is in relation to case "ref:!00D1U01174p.!5004Q02r43Lv:ref"


Thanks,
 
Google Logo Mobile Ads SDK Team


Daniel Borreguero Cano

unread,
Dec 28, 2023, 9:43:05 AM12/28/23
to Google Mobile Ads SDK Developers
Hi, thank you. I will wait for your response.

For mor context, when the user clicks "manage options" "Confirm choices" with all of the purpose set to "true", it also does not shown any ad.  I think it is because all the vendors preferences consent are in "false" (only legitimate interest are in "true").

I have tried with all the purpose set to "true" and a lot of vendors preferences consent set to "true" (Not all of them) and it also does not show any ad.

To clarify, in all of the tests i have done, the consenstInformation.canRequestAds() boolean returns "true" and it initialize the ad. It simply does not show any ad.

if (consentInformation.canRequestAds()) {
     initializeMobileAdsSdk();
}

Thank you.

Mobile Ads SDK Forum Advisor

unread,
Dec 28, 2023, 3:02:42 PM12/28/23
to daniel...@gmail.com, google-adm...@googlegroups.com
Hi Daniel,

Where do you see, "...automatically will display Non-personalized ads or Limited ads"? If a user selects the do not consent option, they will be served limited ads. See our ads serving mode guide for more information on what ads will be served based on the user's consent choices. 

Thanks,
Justin

ref:!00D1U01174p.!5004Q02r43Lv:ref
Reply all
Reply to author
Forward
0 new messages