Search code examples
javaandroidgdprconsentform

How to show consent form with UserMessagingPlatform?


I followed a guide on Google's Documentation, to display a GDPR consent message and I can't get it to show, I used the code from the documentation, but edited the code from the Privacy options section where I added the last argument like this:

consentInformation = UserMessagingPlatform.getConsentInformation(this);
        consentInformation.requestConsentInfoUpdate(
                this,
                params,
                (ConsentInformation.OnConsentInfoUpdateSuccessListener) () -> {
                    UserMessagingPlatform.loadAndShowConsentFormIfRequired(
                            this,
                            (ConsentForm.OnConsentFormDismissedListener) loadAndShowError -> {
                                // ...

                                // Consent has been gathered.

                                if (isPrivacyOptionsRequired()) {
                                    // Regenerate the options menu to include a privacy setting.
                                    ConsentVisibility = true;
                                }
                                else ConsentVisibility = false;
                            }
                    );
                }
        , (ConsentInformation.OnConsentInfoUpdateFailureListener) requestConsentError -> {
        // Consent gathering failed.
        Log.d("ConsentF", String.format("%s: %s",
                requestConsentError.getErrorCode(),
                requestConsentError.getMessage()));
    });

The things I've tried:

  • Testing it with the options from the Testing section,
  • Testing it without the testing options,
  • Testing on an emulator and an actual device,
  • I've also made sure, that my adblocker was inactive.

The consent doesn't show up no matter what I do.¸

Edit: Consent form was also added in Google's Console.


Solution

  • For some odd reason my Consent Message got deleated, after readding it in the AdMob's Console, it didn't work with the debug settings, but it did with normal ones. So it works now.