When I make an application, the first thing I do is to load the ads in my main.lua file :
admob:loadAd("xxx", "xxxx")
Then I move it if it is a banner :
admob:setPosition(200, 200)
In your case you don't need it because the inter take all the screen.
Then I call :
admob:showAd()
In this way, your ad will be loaded and will be ready to be display. But, if the internet connection of the devices isn't good maybe when you will call the showAd() it will be displayed later (maybe few seconds). It could be a problem if the player press "Replay" and the ad will be displayed during the game.
The Ads plugins has lot of event like : AD_RECEIVED AD_FAILED AD_ACTION_BEGIN AD_ACTION_END AD_DISMISSED AD_DISPLAYED
basically your loadAd("interstitial") then receive AD_RECEIVED event with type interstitial if ad loaded or AD_FAILED with type interstitial if ad failed to load if it loaded you can call showAd("interstitial") to show it
so there are two ways to do that 1) admob:showAd("interstitial") will show interstitial as soon as it is loaded
2) or preload and show after it was loaded or even later admob:loadAd("interstitial") admob:adEventListener(Event.AD_RECEIVED, function(e) if e.type == "interstitial" then --interstitial is loaded admob:showAd("interstitial") end end)
Comments
When I make an application, the first thing I do is to load the ads in my main.lua file :
admob:loadAd("xxx", "xxxx")
Then I move it if it is a banner :
admob:setPosition(200, 200)
In your case you don't need it because the inter take all the screen.
Then I call :
admob:showAd()
In this way, your ad will be loaded and will be ready to be display. But, if the internet connection of the devices isn't good maybe when you will call the showAd() it will be displayed later (maybe few seconds). It could be a problem if the player press "Replay" and the ad will be displayed during the game.
The Ads plugins has lot of event like :
AD_RECEIVED
AD_FAILED
AD_ACTION_BEGIN
AD_ACTION_END
AD_DISMISSED
AD_DISPLAYED
Take a look here : http://docs.giderosmobile.com/interface/ads
Have fun !
The Gobb : https://play.google.com/store/apps/details?id=fr.toastapp.thegobb
basically your loadAd("interstitial") then receive AD_RECEIVED event with type interstitial if ad loaded or AD_FAILED with type interstitial if ad failed to load
if it loaded you can call showAd("interstitial") to show it
So once you call
1) admob:showAd("interstitial")
will show interstitial as soon as it is loaded
2) or preload and show after it was loaded or even later
admob:loadAd("interstitial")
admob:adEventListener(Event.AD_RECEIVED, function(e)
if e.type == "interstitial" then
--interstitial is loaded
admob:showAd("interstitial")
end
end)
Here's what I'm using that seems to work well in tests:
Once, at start of app, in main.lua
Likes: Tom2012
I also like the way you can get a no ads version. I'll work that into my app as it's something I use myself when I buy apps.