Dim AdUnitId As String = AdID
Dim ctxt As JavaObject
ctxt.InitializeContext
Dim builder As JavaObject
builder.InitializeNewInstance("com.google.android.gms.ads.AdLoader.Builder", Array(ctxt, AdUnitId))
Dim OnContentAdLoadedListener As Object = builder.CreateEventFromUI("com/google/android/gms/ads/formats/NativeContentAd.OnContentAdLoadedListener".Replace("/", "."), _
"ContentAdLoaded", Null)
builder.RunMethod("forContentAd", Array(OnContentAdLoadedListener))
Dim AdLoader As JavaObject = builder.RunMethod("build", Null)
Dim AdrequestBuilder As JavaObject
AdrequestBuilder.InitializeNewInstance("com/google/android/gms/ads/AdRequest.Builder".Replace("/", "."), Null)
Dim AdRequestBuilder1 As AdRequestBuilder = AdrequestBuilder 'JavaObject builder
If Starter.consent.IsRequestLocationInEeaOrUnknown Then
LogColor("EU or unknown",Colors.Magenta)
AdRequestBuilder1.NonPersonalizedAds
Else
LogColor("non-EU",Colors.Magenta)
End If
LogColor("trying to load content ad",Colors.Red)
AdLoader.RunMethod("loadAd", Array(AdrequestBuilder.RunMethod("build", Null)))
Wait For ContentAdLoaded_Event (MethodName As String, Args() As Object)