Search code examples
admob

UMP ConsentStatus always "NotRequired" when testing


I have incorporated Google's UserMessagingPlatform into my Android project for user consent to be compliant with GDPR for AdMob.

The problem is that the ConsentStatus always returns "NotRequired" when I test it on my phone. I have tried testing using Geography = DebugGeography.Eea but this does not make any difference. Furthermore, since I am based in EEA/UK this should not be required.

I am also tried uninstalling and reinstalling the app and using Reset() but this does not work either.

Form Status is always "Available" and when I force the form to show without checking ConsentStatus it works fine (I have checked and it has registered in the AdMob interface as a message shown).

I am using the Xamarin cross-platform bindings for UMP (https://www.nuget.org/packages/Xamarin.Google.UserMessagingPlatform/1.0.0).

The Google documentation https://developers.google.com/admob/ump/android/quick-start only mentions the following as an example for why consent would give not required as a response:

ConsentStatus.NOT_REQUIRED: User consent not required. For example, the user is not in the EEA or the UK.


Solution

  • Looks like the issue is due to a different order of required cases in Android and iOS modules:

    @Retention(RetentionPolicy.SOURCE)
        public @interface ConsentStatus {
            int UNKNOWN = 0;
            int NOT_REQUIRED = 1;
            int REQUIRED = 2;
            int OBTAINED = 3;
        }
    
    typedef NS_ENUM(NSInteger, UMPConsentStatus) {
      UMPConsentStatusUnknown = 0,      ///< Unknown consent status.
      UMPConsentStatusRequired = 1,     ///< User consent required but not yet obtained.
      UMPConsentStatusNotRequired = 2,  ///< Consent not required.
      UMPConsentStatusObtained =
      3,  ///< User consent obtained, personalized vs non-personalized undefined.
    };