Sub GetAdaptiveAdSize As Map
Dim ctxt As JavaObject
ctxt.InitializeContext
Dim AdSize As JavaObject
Dim width As Int = 100%x / GetDeviceLayoutValues.Scale
Dim Native As JavaObject = AdSize.InitializeStatic("com.google.android.gms.ads.AdSize").RunMethod("getCurrentOrientationAnchoredAdaptiveBannerAdSize", Array(ctxt, width))
Return CreateMap("native": Native, "width": Native.RunMethod("getWidthInPixels", Array(ctxt)), _
"height": Native.RunMethod("getHeightInPixels", Array(ctxt)))
End Sub
Sub position_banner
Dim AdaptiveSize As Map = GetAdaptiveAdSize
Dim height As Int = AdaptiveSize.Get("height")
Activity.AddView(BannerAd, 0, (100%y - height), AdaptiveSize.Get("width"), height)
BannerAd.LoadAd
BannerAd.BringToFront
End Sub