ads.show Listener?

It takes even few secods before ad show so how can I do something after ad is shown? I have few ads.show in one scene so I think listener from ads.init isn’t an good options. Any ideas?

Hi @naitver,

Which ad provider are you using?

Brent

AdMob.

Are you trying to show banners or interstitials? If interstitials, did you pre-load the ad in advance of showing it?

I want to show interstitials. How I can pre-load them before show? I was try to make something like that:

local ads = require("ads") ads.load("interstitial")

And then somewhere else just use ads.show but I think it’s not working like that.

Well, first thing is that you need to initialize the ad provider before doing anything else. Have you consulted the documentation for AdMob?

https://docs.coronalabs.com/plugin/ads-admob-v2/index.html

Best regards,

Brent

Yes I initialize it and ads is working but they are showing after few seconds after ads.show is called.

local function continuelistener(event) local phase = event.phase if phase == "ended" then if settings.sounds then audio.play(buttonsound) end composer.removeScene("menu") composer.gotoScene("campaign",{params = {selectedlevel = settings.level}}) if settings.ads then ads.show("interstitial",{x = cx,y = cy}) end end end

Is there any way to make it faster?

local function adListener( event ) if ( ads.isLoaded("interstitial") ) then ads.show("interstitial") --audio.play(buttonsound) \<-- it wont play the sound unless the ad is loaded end end ads.init( adProvider, appID, adListener ) \<--my ads dont work without this line

you want to have 

local buttonsound = audio.load("whatever.mp3)

neer the top for convenience 

Hi @naitver,

Which ad provider are you using?

Brent

AdMob.

Are you trying to show banners or interstitials? If interstitials, did you pre-load the ad in advance of showing it?

I want to show interstitials. How I can pre-load them before show? I was try to make something like that:

local ads = require("ads") ads.load("interstitial")

And then somewhere else just use ads.show but I think it’s not working like that.

Well, first thing is that you need to initialize the ad provider before doing anything else. Have you consulted the documentation for AdMob?

https://docs.coronalabs.com/plugin/ads-admob-v2/index.html

Best regards,

Brent

Yes I initialize it and ads is working but they are showing after few seconds after ads.show is called.

local function continuelistener(event) local phase = event.phase if phase == "ended" then if settings.sounds then audio.play(buttonsound) end composer.removeScene("menu") composer.gotoScene("campaign",{params = {selectedlevel = settings.level}}) if settings.ads then ads.show("interstitial",{x = cx,y = cy}) end end end

Is there any way to make it faster?

local function adListener( event ) if ( ads.isLoaded("interstitial") ) then ads.show("interstitial") --audio.play(buttonsound) \<-- it wont play the sound unless the ad is loaded end end ads.init( adProvider, appID, adListener ) \<--my ads dont work without this line

you want to have 

local buttonsound = audio.load("whatever.mp3)

neer the top for convenience