My current code is the following :
1) Manifest (where xxxxx~yyyyy is my AdMob Application ID)
'AdMob
AddApplicationText(
<meta-data android:name="com.google.android.gms.version"
android:value="@integer/google_play_services_version"/>
<activity android:name="com.google.android.gms.ads.AdActivity"
android:configChanges="keyboard|keyboardHidden|orientation|screenLayout|uiMode|screenSize|smallestScreenSize"/>
)
'End of AdMob
AddReplacement($ADMOB_APP_ID$,
ca-app-pub-xxxxxxxxxxxx~yyyyyyyyy)
2) In Sub Globals
Public consent As ConsentManager
Private BannerAd As AdView
Private IAd As InterstitialAd
Dim MobileAds As MobileAds
3) In Activity_Create (where zzzzz is my Ad ID)
MobileAds.Initialize
BannerAd.Initialize2("BannerAd", "ca-app-pub-zzzzzzzzzzzzzzzzzzz", BannerAd.SIZE_SMART_BANNER)
consent.Initialize("consent")
consent.RequestInfoUpdate(Array("pub-xxxx"))
Wait For consent_InfoUpdated (Success As Boolean)
If Success = False Then
Log($"Error getting consent state: ${LastException}"$)
End If
Log($"Consent state: ${consent.ConsentState}"$)
Log("EU: " & consent.IsRequestLocationInEeaOrUnknown)
Dim height As Int
If GetDeviceLayoutValues.ApproximateScreenSize < 6 Then
'phones
If 100%x > 100%y Then height = 32dip Else height = 50dip
Else
'tablets
height = 90dip
End If
Activity.AddView(BannerAd, 0dip, 100%y - height, 100%x, height)
BannerAd.LoadAd
When I execute on emulator, I get a test AD banner displaying "Nice Job. This is a 320x200 test AD" (while I used my real AdMob IDs)
When I execute on physical device, no Ad is displayed and I get error code = 3.
In both cases log displays 3 messages :
Error getting consent state: java.lang.Exception: Could not parse Event FE preflight response.
Consent state: UNKNOWN
EU: false
NB : I also read elsewhere in the forum I need to generate a "google-services.json" but don't know if it is still necessary or not.
As I said ... I'm lost