Android Question New Google consent management requirements for serving ads

Spright

Active Member
I saw that one and have it I will have a second look if I can use it properly with my project it was tough the last time i tried.
I picke simpler version I found that was newer ( 2023). Maybe I'm doing something wrong and they are all actually okay.
 
Upvote 0

Spright

Active Member
This is the one I am using currently, is it not okay?
 
Upvote 0

yiankos1

Well-Known Member
Licensed User
Longtime User
Do you need the consentform even for rewarded fullscreen ads which the user presses him/herself to activate?
Type of ads has nothing to do about consent form. If you show ads at EU and GB you will have to show the UMP consent form sometime in 2023.
 
Upvote 0

yiankos1

Well-Known Member
Licensed User
Longtime User
Can you post the warning message?
Warning message is in admob site and says following:
"Later this year, Google will require all publishers serving ads to users in the EEA and UK to use a Google-certified Consent Management Platform (CMP). You can use any Google-certified Consent Management Platform (CMP) for this purpose, including Google's Consent Management Solution. If you are interested in using Google's consent management solution, start by configuring the GDPR message and implementing the UMP SDK. Learn more"
 
Last edited:
Upvote 0

yiankos1

Well-Known Member
Licensed User
Longtime User
Are you showing the consent form?
I think SDK did not updated since then (not sure) and if user decline at consent form then no ad will be shown.... It will have a huge impact at ad revenue... All other UMP solutions that are accepted by google admob are paid solutions.
 
Upvote 0

asales

Expert
Licensed User
Longtime User
Can you post the warning message?
In the warning message there are this links:
Are you showing the consent form?
No, but due this new requirement I will show.
 
Upvote 0

Pendrush

Well-Known Member
Licensed User
Longtime User
if user decline at consent form then no ad will be shown
You can restrict user to use app if non-personalized/personalized consent is not given.
User just need to click on MORE OPTIONS and then OK, this will completely turn off ADS in app, so user can use your app without ADS free of charge.

Here is a solution to know what kind of AD is user selected and whether applications can display advertisements at all.

Kotlin/Swift:

Java:
 
Upvote 0

yiankos1

Well-Known Member
Licensed User
Longtime User
Here is a solution to know what kind of AD is user selected and whether applications can display advertisements at all.
I am not sure if it is legit to disable part of app according to user's preferences...
 
Upvote 0

Spright

Active Member
These are not making any ssense to me, can someone please explain what it means in simple terms?

I got simple banners and rewarded ads finally going, and this comes along, should i ditch them? Does this mean additional techology / API's being involved? Even Money?

I just use the standard Google setup, no extra networks etc

I'm thinking of just make the app premium now, and another app outside EU / UK that can use what I have learned to do so far with with ads, it feels stupid to throw all hard work away.
 
Upvote 0

Spright

Active Member
After constant reading and checking, this is what works on across all my devices, and it asks for conscent (ONCE).

I checked for one page version, and one libgdx/activity version. This is the second one as the dirst one is already accessible on the forum as-is by Erel.

B4X:
  #MultiDex: True

#Region Project Attributes
    #FullScreen: True
    #IncludeTitle: False
    #ApplicationLabel: Demo
    #VersionCode: 1
    #VersionName:
    #SupportedOrientations: Portrait
    #CanInstallToExternalStorage: False
#End Region

#Region Activity Attributes
#End Region

#AdditionalJar: com.google.android.ump:user-messaging-platform

Sub Process_Globals
    Private xui As XUI
End Sub

Sub Globals
    Dim GL As lgGL
    Dim lGdx As LibGDX
    Dim IP As lgInputProcessor
    Dim Batch As lgSpriteBatch
    Dim texsheet As lgTexture
    Dim adwanted As Boolean = True
    Dim Surface As View
    Dim tm As Timer
    Dim Camera As lgOrthographicCamera
    Private Ads As AdsHelper
    Private BannerAd As AdView
    Private BannerAdFixedSize As AdView
    Private iAd As InterstitialAd
    Private Ads As AdsHelper
    Private AppOpenAdUnit As String = "ca-app-pub-3940256099942544/3419835294"
End Sub

Sub Activity_Create(FirstTime As Boolean)
    Activity.Color=Colors.Black
    If FirstTime = True Then
        Dim Config As lgConfiguration
        Config.useAccelerometer = False
        Config.useCompass = False
        Config.useWakelock = True
        Config.hideStatusBar = True
        Config.useImmersiveMode = True
        Config.r = 8
        Config.g = 8
        Config.b = 8
        Config.a = 8
        Config.numSamples = 0
        Config.maxSimultaneousSounds = 8
        Surface = lGdx.InitializeView2(Config, "LG")
        Activity.AddView(Surface, 0, 0, 100%x, 100%y)
        tm.Initialize("timer",4000*4)
        tm.Enabled = True
    End If
    
    Dim ButtonPanel As Panel
    ButtonPanel.Initialize("")
    Activity.AddView(ButtonPanel, 0, 250dip, 100%x, 150dip)
    ButtonPanel.LoadLayout("MainPage")
    Ads.Initialize
    CheckConsentAndAddAds
    
    ' OLD ADS
    ' Create the panel view and add it to the activity
'    Dim panel As Panel
'    panel.Initialize("")
'    panel.Color = Colors.White
'    panel.SetLayout(0, 0, 100%x, 90dip)
'    Activity.AddView(panel, 0, 0, 100%x, 90dip)
'    ' Initialize and load the adaptive ad inside the panel
'    Dim size As AdSize = GetAdaptiveAdSize
'    Dim adHeight As Int = size.Height
'    Dim adView As AdView
'    adView.Initialize2("ad", "ca-app-pub-3940256099942544/6300978111", size.Native)
'    panel.Color = Colors.Transparent
'    panel.AddView(adView, 0, 0, size.Width, adHeight)
'    adView.LoadAd

End Sub

Sub Activity_Resume
    Ads.ShowOpenAdIfAvailable(1)
    If lGdx.IsInitialized Then lGdx.Resume
End Sub

Sub Activity_Pause (UserClosed As Boolean)
    If UserClosed Then Ads.Background
    If lGdx.IsInitialized Then lGdx.Pause
End Sub

Sub LG_Create
    Batch.Initialize
    IP.Initialize("IP")
    texsheet.Initialize("sprite.png")
    Camera.Initialize
    Camera.SetToOrtho(False)
End Sub


Sub LG_Render
    GL.glClearColor(0, 0, 1, 1)
    GL.glClear(GL.GL10_COLOR_BUFFER_BIT)
    Camera.Update
    Batch.ProjectionMatrix = Camera.Combined
    Batch.Begin
    Dim X, Y As Int
    For i = 1 To 99
        X = Rnd(0,999)
        Y = Rnd(0,499)
        Batch.DrawTex2(texsheet, X, Y, 100dip, 100dip)
    Next
    Batch.End
End Sub
 
Sub LG_Resume
End Sub

Sub LG_Pause
End Sub

' ADD LG RESIZE

Sub LG_Dispose
    If texsheet.IsInitialized Then texsheet.dispose
    If Batch.IsInitialized Then Batch.dispose
End Sub

Sub IP_TouchDown(ScreenX As Int, ScreenY As Int, Pointer As Int) As Boolean
    Return True
End Sub

Sub ToastMsg_Show(Text As Object)
    ToastMessageShow(Text, True)
End Sub

Sub timer_Tick
    Log("TIMER!")
End Sub

Private Sub CheckConsentAndAddAds
    Dim m As MobileAds
    Wait For (m.Initialize) MobileAds_Ready
    LogColor("After MobileAds_Ready", Colors.Magenta)
    ' m.SetConfigutation(m.CreateRequestConfigurationBuilder(Array("77A04EE40B2AFED2AFC67701365187EC"))) 'optional. Array with test device ids. See unfiltered logs to find correct id.
    ' Ads.ResetConsentStatus
    ' Ads.SetConsentDebugParameters("77A04EE40B2AFED2AFC67701365187EC", True) 'same id as above
    If Ads.GetConsentStatus = "UNKNOWN" Or Ads.GetConsentStatus = "REQUIRED" Then
        Wait For (Ads.RequestConsentInformation(False)) Complete (Success As Boolean)
    End If
    If Ads.GetConsentStatus = "REQUIRED" And Ads.GetConsentFormAvailable Then
        Wait For (Ads.ShowConsentForm) Complete (Success As Boolean)
    End If
    Log("Consent: " & Ads.GetConsentStatus)
    LoadAds
End Sub

Sub LoadAds
    Dim AdaptiveSize As Map = Ads.GetAdaptiveAdSize
    ' AdaptiveSize.Get("native")
    ' load a fixed size banner ad
    BannerAdFixedSize.Initialize2("BannerAdFixedSize", "ca-app-pub-3940256099942544/6300978111", BannerAd.SIZE_IAB_MRECT)
    Activity.AddView(BannerAdFixedSize, (100%x-300dip)/2, 0, 300dip, 250dip)
    BannerAdFixedSize.LoadAd
    
    BannerAd.Initialize2("BannerAd", "ca-app-pub-3940256099942544/6300978111", AdaptiveSize.Get("native"))
    Activity.AddView(BannerAd, 0, 100%y-AdaptiveSize.Get("height"), AdaptiveSize.Get("width"), AdaptiveSize.Get("height"))
    BannerAd.LoadAd
    
    iAd.Initialize("iad", "ca-app-pub-3940256099942544/1033173712")
    iAd.LoadAd
    
    Ads.FetchRewardedInterstitialAd("ca-app-pub-3940256099942544/5354046379", Me, "RewardedInterstitialAd")
    Ads.FetchRewardedVideoAd("ca-app-pub-3940256099942544/5224354917", Me, "RewardAd")
    Ads.FetchOpenAd(AppOpenAdUnit, Me, "OpenAd")
End Sub

#Region Button Click Events
Private Sub Button1_Click
    If iAd.Ready Then
        iAd.Show
    Else
        Log("no Iad is available")
    End If
    iAd.LoadAd
End Sub

Private Sub Button2_Click
    If Ads.isAvailableRewardedInterstitialAd Then
        Ads.ShowRewardedInterstitialAd
    Else
        Log("wait... loading reward ad")
        Ads.FetchRewardedInterstitialAd("ca-app-pub-3940256099942544/5354046379", Me, "RewardedInterstitialAd")
    End If
End Sub

Private Sub Button_Native_Click
    ' B4XPages.ShowPage("B4XNative2")
    StartActivity(NativeActivity)
End Sub

Private Sub Button_RewardedVideo_Click
    If Ads.isAvailableRewardedVideoAd Then
        Ads.ShowRewardedVideoAd
    Else
        Log("wait... loading reward ad")
        Ads.FetchRewardedVideoAd("ca-app-pub-3940256099942544/5224354917", Me, "RewardAd")
    End If
End Sub
#End Region

#Region Ad Events
Sub BannerAd_ReceiveAd
    Log("BannerAd_ReceiveAd")
End Sub

Sub BannerAd_FailedToReceiveAd (ErrorCode As String)
    Log("BannerAd_FailedToReceiveAd ErrorCode=" & ErrorCode)
End Sub

Sub BannerAd_AdClosed
    Log("BannerAd_AdClosed")
End Sub

Sub BannerAd_AdOpened
    Log("BannerAd_AdOpened")
End Sub

Sub BannerAdFixedSize_ReceiveAd
    Log("BannerAdFixedSize_ReceiveAd")
End Sub

Sub BannerAdFixedSize_FailedToReceiveAd (ErrorCode As String)
    Log("BannerAdFixedSize_FailedToReceiveAd ErrorCode=" & ErrorCode)
End Sub

Sub BannerAdFixedSize_AdClosed
    Log("BannerAdFixedSize_AdClosed")
End Sub

Sub BannerAdFixedSize_AdOpened
    Log("BannerAdFixedSize_AdOpened")
End Sub

Sub iAd_ReceiveAd
    Log("IAd received. Now wait for the right moment to show the ad.")
End Sub

Sub iAd_FailedToReceiveAd (ErrorCode As String)
    Log("Failed: " & ErrorCode)
End Sub

Sub iAd_AdClosed
    Log("Closed")
End Sub

Sub iAd_AdOpened
    Log("Opened")
End Sub

' Open Ad Events
Sub OpenAd_ReceiveAd
    LogColor($"OpenAd_ReceiveAd"$, Colors.Green)
End Sub

Sub OpenAd_FailedToReceiveAd (ErrorCode As String)
    LogColor($"OpenAd_FailedToReceiveAd ErrorCode=${ErrorCode}"$, Colors.Green)
End Sub

' Rewarded video ad events
Sub RewardAd_ReceiveAd
    LogColor($"RewardAd_ReceiveAd"$, Colors.Green)
End Sub

Sub RewardAd_FailedToReceiveAd (ErrorCode As String)
    LogColor($"RewardAd_FailedToReceiveAd ErrorCode=${ErrorCode}"$, Colors.Green)
End Sub

Sub RewardAd_Rewarded (Item As Object)
    LogColor("RewardAd_Rewarded",Colors.Green)
    Dim Reward As JavaObject = Item
    Dim Amount As Int = Reward.RunMethod("getAmount", Null)
    Dim RewardType As String = Reward.RunMethod("getType", Null)
    Log("Rewarded: " & Amount & " -> " & RewardType)
End Sub

' Rewarded interstitial events
Sub RewardedInterstitialAd_ReceiveAd
    LogColor($"RewardInterstitialAd_ReceiveAd"$, Colors.Green)
End Sub

Sub RewardedInterstitialAd_FailedToReceiveAd (ErrorCode As String)
    LogColor($"RewardedInterstitialAd_FailedToReceiveAd ErrorCode=${ErrorCode}"$, Colors.Green)
End Sub

Sub RewardedInterstitialAd_Rewarded (Item As Object)
    LogColor("RewardedInterstitialAd_Rewarded",Colors.Green)
    Dim Reward As JavaObject = Item
    Dim Amount As Int = Reward.RunMethod("getAmount", Null)
    Dim RewardType As String = Reward.RunMethod("getType", Null)
    Log("Rewarded: " & Amount & " -> " & RewardType)
End Sub

#End Region
 

Attachments

  • ModernAds.zip
    28.8 KB · Views: 74
Upvote 0

Spright

Active Member
If you do not conscent, is it impossible to get rewards, will rewardads still work? I use reward ads as the driving mechanism to get important features in the app it would be worthless if the user would not get that. Banners can be a separate issue..
 
Upvote 0
Top