'Dim MobileAds As MobileAds
'MobileAds.Initialize
Dim volume As Float = 0.5
Dim jo As JavaObject
jo.InitializeStatic("com.google.android.gms.ads.MobileAds")
jo.RunMethod("setAppVolume", Array(volume))
or
B4X:
Dim mute As Boolean = True
Dim jo As JavaObject
jo.InitializeStatic("com.google.android.gms.ads.MobileAds")
jo.RunMethod("setAppMuted", Array(mute))
initialize the mobile ads with the "Admob App ID" in the manifest.
There is no problem if I use several RunMethod? I can use like this?
B4X:
jo.RunMethod("initialize", Array(ctxt, "ca-app-pub-3940256099942544~3347511713")) 'Sample ID
jo.RunMethod("setAppVolume", Array(volume))
jo.RunMethod("setAppMuted", Array(mute))
or I can initialize the MobileAds and initialize another JavaObject to set the AppMuted?
B4X:
Dim MobileAds As MobileAds
MobileAds.Initialize
Dim MobileAds2 As JavaObject
MobileAds2.InitializeStatic("com.google.android.gms.ads.MobileAds")
MobileAds2.RunMethod("setAppMuted", Array(True))
I'm a little bit confused. So, my final code will be this (in Starter):
B4X:
Dim MobileAds As MobileAds
MobileAds.Initialize
Dim mute As Boolean = True
Dim jo As JavaObject
jo.InitializeStatic("com.google.android.gms.ads.MobileAds")
jo.RunMethod("setAppMuted", Array(mute))