Do we have support for Adaptive Banners in AdMob?
More info: https://developers.google.com/admob/android/banner/adaptive
More info: https://developers.google.com/admob/android/banner/adaptive
Sub GetAdaptiveAdSize As AdSize
Dim ctxt As JavaObject
ctxt.InitializeContext
Dim AdSize As JavaObject
Dim width As Int = 100%x / GetDeviceLayoutValues.Scale
Dim res As AdSize
res.Native = AdSize.InitializeStatic("com.google.android.gms.ads.AdSize").RunMethod("getCurrentOrientationAnchoredAdaptiveBannerAdSize", Array(ctxt, width))
Dim jo As JavaObject = res.Native
res.Width = jo.RunMethod("getWidthInPixels", Array(ctxt))
res.Height = jo.RunMethod("getHeightInPixels", Array(ctxt))
Return res
End Sub
Type AdSize (Native As Object, Width As Int, Height As Int)
Dim size As AdSize = GetAdaptiveAdSize
adview1.Initialize2("ad", "ca-app-pub-126753333333/948333333", size.Native)
Activity.AddView(adview1, 0, 0, size.Width, size.Height)
And this line:3. Usage:
B4X:Dim size As AdSize = GetAdaptiveAdSize adview1.Initialize2("ad", "ca-app-pub-126753333333/948333333", size.Native) Activity.AddView(adview1, 0, 0, size.Width, size.Height)
adview1.LoadAd
Would you be able to indicate which of the recommended below I should do?4. Minversion of Artifact: 18.3.0
Solution: Start B4ASDKManager and download all recommended items.
download all recommended items
Which problem? I don´t see you posted it in this thread!?I installed the recommendations but problem persists.
Your code is wrong, as you assume that ad height is 10%y.sorry solved ?
B4X:Activity.AddView(adview1, 0, 90%y, size.Width, size.Height)
Activity.AddView(adview1, 0, 100%y-size.Height, size.Width, size.Height)
ohh ok thx master ....?Your code is wrong, as you assume that ad height is 10%y.
Code should be like:
B4X:Activity.AddView(adview1, 0, 100%y-size.Height, size.Width, size.Height)