Hi all I've decided to resurrect an old game I started working on 9 years ago! I'm almost done and am just in the process of adding admob ads.
I have a simple function that I call which is:
function MyAds:displayInterstitial()
self.ADMOB:loadAd("interstitial", self.Interstitial)
end
I've made sure I am only calling this once in the scene but whenever I close the ad another one loads straight after it. I'm on the latest version of Gideros and the is on android api 30. I'm also enableTesting() not sure if that make a difference?
I wanted to see if anyone had any ideas before I go trying to do something hacky to hide them.
Comments
loadAd() only preloads an Ad, showAd() shows an ad (eventually loading it if not yet preloaded). You shouldn't call showAd() in the AD_RECEIVED handler as @MoKaLux did, because if you do you don't know when the ad will be actually shown (it will depend on the time taken to load the ad from the network).
The way it is supposed to work is as follow:
1. Call loadAd() as soon as possible in your code to have an Ad ready to be shown when needed.
2. When you need to show an ad, check if the Ad has been loaded. If so call showAd(), otherwise handle the 'ad not ready' case as you wish (inform the user, skip the ad, try to call loadAd() once more, etc)
3. As soon as the ad was shown (AD_DISMISSED) call loadAd() again to preload the next Ad.
I was working on Gideros ads plugin yesterday, and I noticed some ad providers would automatically load next Ad when the previous was shown, thus trigering AD_RECEIVED even if you didn't call loadAd() yourself. I saw that it AppLovin code, which was copied from Admob code...
Likes: MoKaLux
Likes: MoKaLux
Twitter: http://twitter.com/anefiox
Google Play: https://play.google.com/store/apps/details?id=com.anefiox.rainbowball