User Messaging Platform (UMP) Library

Pendrush

Well-Known Member
Licensed User
Longtime User
A new better way to get consent from EEA users.
Please read what you need to do on this link: https://developers.google.com/admob/ump/android/quick-start

Prerequisites:
  • Funding Choices account linked to your AdMob account.
  • To create a Funding Choices account, go to Blocking Controls > EU user consent in the AdMob UI and select manage consent with Funding Choices. The Funding Choices account is then created automatically in the background.
  • You also need to create Consent form and make it Active.

UserMessagingPlatform

Author:
Author: Google - B4a Wrapper: Pendrush
Version: 1.01
  • UserMessagingPlatform
    • Events:
      • OnConsentFormDismissed
      • OnConsentFormLoadFailure (Error As String)
      • OnConsentInfoUpdate
      • OnConsentInfoUpdateFailure (Error As String)
      • OnConsentInfoUpdateSuccess
    • Fields:
      • CONSENT_STATUS_NOT_REQUIRED As Int
      • CONSENT_STATUS_OBTAINED As Int
      • CONSENT_STATUS_REQUIRED As Int
      • CONSENT_STATUS_UNKNOWN As Int
      • CONSENT_TYPE_NON_PERSONALIZED As Int
      • CONSENT_TYPE_PERSONALIZED As Int
      • CONSENT_TYPE_UNKNOWN As Int
      • DEBUG_GEOGRAPHY_DISABLED As Int
      • DEBUG_GEOGRAPHY_EEA As Int
      • DEBUG_GEOGRAPHY_NOT_EEA As Int
    • Functions:
      • ForceShowForm
        If user is not in EEA we don't need to show a Form, also if user already give his consent he/she have a right to change it.
        If Ump.ConsentStatus=Ump.CONSENT_STATUS_REQUIRED Or Ump.ConsentStatus=Ump.CONSENT_STATUS_OBTAINED Then
        If Ump.IsConsentFormAvailable Then
        Ump.ForceShowForm
        End If
        Else
        Log ("We don't need to show a Form")
        End If
      • Initialize (EventName As String, IsDebug As Boolean)
        Initialize User Messaging Platform
        Ump.Initialize("Ump", False)
      • LoadAndShowForm
        Will show form only if Ump.ConsentStatus=Ump.CONSENT_STATUS_REQUIRED, if form is not shown OnConsentInfoUpdate event will fire
        For user out of EEA zone Ump.IsConsentFormAvailable will be False, but also Google give some info why form maybe unavailable:
        There are a variety of reasons why a form may not be available, such as:
        The user has limited ad tracking enabled.
        You tagged the user As under the age of consent.
        Read more on this link: https://developers.google.com/admob/ump/android/quick-start
      • Reset
        Reset Consent state
        In testing your app with the UMP SDK, you may find it helpful to reset the state of the consent SDK
        so that you can simulate a user's first install experience.
        Use reset right after Initialize and use it ONLY FOR TESTING.
    • Properties:
      • ConsentStatus As Int [read only]
        Get Consent status
        If Ump.ConsentStatus=Ump.CONSENT_STATUS_NOT_REQUIRED Then
        Log ("NOT_REQUIRED")
        Enf If
      • ConsentType As Int [read only]
        Get Consent type
        If Ump.ConsentType = Ump.CONSENT_TYPE_PERSONALIZED Then
        Log ("PERSONALIZED")
        Enf If
      • DebugGeography As Int [write only]
        This line is for TESTING only and MUST BE set before Initialize method
        Ump.DebugGeography = Ump.DEBUG_GEOGRAPHY_EEA
      • IsConsentFormAvailable As Boolean [read only]
        Check is Consent Form available
        There are a variety of reasons why a form may not be available, such as:
        The user has limited ad tracking enabled.
        You tagged the user As under the age of consent.
        Read more on this link: https://developers.google.com/admob/ump/android/quick-start
      • TestDeviceHashedId As String [write only]
        This line is for TESTING only and MUST BE set before Initialize method
        Use unfiltered log to find your TestDeviceHashedId - Line look like this:
        Use new ConsentDebugSettings.Builder().addTestDeviceHashedId("43AC6A74FCA5ABEAF9DF0214C5179153")
        Ump.TestDeviceHashedId = "YOUR_TEST_DEVICE_ID"

You need to add your Application ID in manifest
B4X:
AddApplicationText(<meta-data
            android:name="com.google.android.gms.ads.APPLICATION_ID"
            android:value="ca-app-pub-XXXXXXXXXXXXXXX~YYYYYYYYYY" />)


Download library zip file and extract archive to Additional Libraries folder.
 

Attachments

  • UmpLibrary.zip
    106.4 KB · Views: 395
  • UmpBannerExample.zip
    12.1 KB · Views: 399
Last edited:

Pendrush

Well-Known Member
Licensed User
Longtime User
Commonly used vendors, but you can edit Consent Form later, also you can delete form and create a new one.
 

yiankos1

Well-Known Member
Licensed User
Longtime User
Same here, also check this out:
Edit:
and this:
Indeed! I have exactly the same problems as described. If a user want to manage his preference, then no ads will be served. Moreover all buttons will result to UNKNOWN. So we have to wait in order to be fixed this buggy SDK. Because as I read, all apps will have to be annoying like site's cookies. So this library will be a must-have for all apps.
 

Pendrush

Well-Known Member
Licensed User
Longtime User
I believe they will upgrade the existing version soon, as this one have a lot of different problems.
 

yiankos1

Well-Known Member
Licensed User
Longtime User
I believe they will upgrade the existing version soon, as this one have a lot of different problems.
I believe they will upgrade the existing version soon, as this one have a lot of different problems.
So I will be needed a new version of your library?
 

Pendrush

Well-Known Member
Licensed User
Longtime User
Wrapper is OK. I have exact same problems with native implementation. I will update wrapper when they update original library. Maybe the problem is on their server backend and problems resolve it self without library updates. Who knows.
 

yiankos1

Well-Known Member
Licensed User
Longtime User
Wrapper is OK. I have exact same problems with native implementation. I will update wrapper when they update original library. Maybe the problem is on their server backend and problems resolve it self without library updates. Who knows.
I searched a lot and i found out this post. There is an engineer from google support that mentions UKNOWN result is normal behavior and we should use this framework to play with consent.
 

Pendrush

Well-Known Member
Licensed User
Longtime User
I searched a lot and i found out this post.
Post is for JS implementation, for websites.
I did not find any working Android implementation.
This is error when you opt-out from tracking, 100% native (Kotlin) implementation, you get same error from B4a implementation:
I/System.out: ConsentInformation.ConsentStatus.OBTAINED
I/System.out: ConsentInformation.ConsentType.UNKNOWN
I/Ads: This request is sent from a test device.
I/System.out: No ad config.
I/Ads: Ad failed to load : 3
If you find native Java/Kotlin implementation on Internet that is working, please report here and I will make changes in wrapper.
 
Last edited:

Computersmith64

Well-Known Member
Licensed User
Longtime User
Post is for JS implementation, for websites.
I did not find any working Android implementation.
This is error when you opt-out from tracking, 100% native (Kotlin) implementation, you get same error from B4a implementation:

If you find native Java/Kotlin implementation on Internet that is working, please report here and I will make changes in wrapper.
There isn't a working version that I'm aware of. I have apps written in both Kotlin & Swift where if the user taps the "Do not consent" button, AdMob will not serve any ads at all. As it is, the Funding Choices GDPR consent setup is unusable. You might as well just not serve ads to EU users. The ATT (App Tracking Transparency) for iOS14+ through Funding Choices works OK, but not the GDPR consent interface.

- Colin.
 
Top