Android Question AdsHelper extension and ad loading

_marek

Member
Licensed User
Longtime User
Hello guys,
I am trying to implement AdsHelper Extension for Traditional B4A apps from @Jack Cole. All is working.

However, I noticed that with logic presented in the example attached to that post, it is possible that ads are shown without consent form being shown at all:
B4X:
Private Sub CheckConsentAndAddAds
    Dim m As MobileAds
    
    Wait For (m.Initialize) MobileAds_Ready
    LogColor("After MobileAds_Ready", Colors.Magenta)

    If Starter.Ads.GetConsentStatus = "UNKNOWN" Then
        Wait For (Starter.Ads.RequestConsentInformation(False)) Complete (Success As Boolean)
    End If
    If Starter.Ads.GetConsentStatus = "REQUIRED" And Starter.Ads.GetConsentFormAvailable Then
        Wait For (Starter.Ads.ShowConsentForm) Complete (Success As Boolean)
    End If
    Log("Consent: " & Starter.Ads.GetConsentStatus)
    LoadAds
End Sub
If user starts the app without network connection, consent form is not shown, but LoadAds is called anyway.
Ad loading fails until user connects to internet.

1687685021904.png


So it seems to me, that we should call LoadAds only if consent state is NOT_REQUIRED or OBTAINED.

Or am I missing something?
Note: I am testing in EEA.

Thanks,
Marek
 
Top