Android Question Question about class AdsHelper

Filippo

Expert
Licensed User
Longtime User
Hi,

I have been using classe AdsHelper for a long time without any problems.
Now Google requires that you use their own GDPR form, at least that's what I understood.

As long as the "Consent" button is selected, everything works correctly (I have disabled the "Do not consent" button on purpose.).
But if the button "Manage options" -> "Confirm selection" is selected, then no advertising is displayed.
With "Manage options" -> "Confirm selection", the advertising is displayed normally.

Is this normal, or am I doing something wrong?
 

AnandGupta

Expert
Licensed User
Longtime User
(I have disabled the "Do not consent" button on purpose.).
I think, if "Do not consent" was the 2nd button then by disabling it you made "Manage.." the second and the value for it us used as "Do not consent" logic.
 
Upvote 0

Filippo

Expert
Licensed User
Longtime User
I think, if "Do not consent" was the 2nd button then by disabling it you made "Manage.." the second and the value for it us used as "Do not consent" logic.
Unfortunately, this is not so.

I have already tried with the "Do not consent" button enabled, without success.
I also don't understand why the "Consent" button and the "Do not consent" button give the same result.

Here are the logs, once with "Consent" and once with "Do not consent":

Here is the code:
B4X:
Public Sub CheckConsentAndAddAds
    Dim m As MobileAds
    
    Wait For (m.Initialize) MobileAds_Ready
'    LogColor("After MobileAds_Ready", Colors.Magenta)

    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 & " ;Success=" & Success)
    
    LoadAds(False)

End Sub

I want that when the user selects the "Do not consent" button, a message box is displayed and the app is closed.
 
Upvote 0

Filippo

Expert
Licensed User
Longtime User
Something is misconfigured. Maybe the form is broken.

It shouldn't return the same value if the user clicks on the Do not consent button.
It may be that something is misconfigured, but I can't imagine what.
I use the class from @Jack Cole.

No matter what I set, the answer is always: "Consent: OBTAINED"
 
Upvote 0

Filippo

Expert
Licensed User
Longtime User
I also have the example from @Jack Cole, unfortunately with the same error.
Therefore I assume that there must be an error in this class.

Has anyone had the same experience?
 
Upvote 0

Filippo

Expert
Licensed User
Longtime User
Upvote 0

Filippo

Expert
Licensed User
Longtime User
Here is a test with your example and 2 logs, one with "Consent" and one with "Do not consent".
I don't see any difference what the user has selected.

B4X:
Private Sub CheckConsentAndAddAds
    Dim m As MobileAds
    Wait For (m.Initialize) MobileAds_Ready
    m.SetConfiguration(m.CreateRequestConfigurationBuilder(Array("0BAB27F6EE97F9B5FA3B8C59548E8A34"))) 'optional. Array with test device ids. See unfiltered logs to find correct id.
    
'    Ads.ResetConsentStatus
'    Ads.SetConsentDebugParameters("0BAB27F6EE97F9B5FA3B8C59548E8A34", True) 'same id as above
    
    If Ads.GetConsentStatus = "UNKNOWN" Or Ads.GetConsentStatus = "REQUIRED" Then
        Wait For (Ads.RequestConsentInformation(False)) Complete (Success As Boolean)
        Log("1.Consent: " & Ads.GetConsentStatus & " ;Success=" & Success)
    End If
    If Ads.GetConsentStatus = "REQUIRED" And Ads.GetConsentFormAvailable Then
        Wait For (Ads.ShowConsentForm) Complete (Success As Boolean)
        Log("2.Consent: " & Ads.GetConsentStatus & " ;Success=" & Success)
    End If
    Log("3.Consent: " & Ads.GetConsentStatus)

    Dim AdaptiveSize As Map = Ads.GetAdaptiveAdSize
    BannerAd.Initialize2("BannerAd", "ca-app-pub-xxxxxxxxxxxxxxxx/xxxxxxxxxxx",AdaptiveSize.Get("native"))
    Root.AddView(BannerAd, 0, 0,  AdaptiveSize.Get("width"), AdaptiveSize.Get("height"))
    BannerAd.LoadAd
    iAd.Initialize("iad", "ca-app-pub-xxxxxxxxxxxxxxxx/xxxxxxxxxxx")
    iAd.LoadAd
    Ads.FetchOpenAd(AppOpenAdUnit)
End Sub

Consent:

Do not Consent:
 
Upvote 0

Filippo

Expert
Licensed User
Longtime User
I really don't want to be a pain, but I still don't have a solution.
How can I know if the user has selected "Do not consent"?
I have tried Erel's example and it does not work either.
Has anyone had the same problem and found a solution?
 
Upvote 0
Cookies are required to use this site. You must accept them to continue using the site. Learn more…