[SOLVED] How to tell if an ad is being displayed

I’m sure this is covered somewhere but i cannot seem to find any definitive answers on it so here it goes. We are getting ready to release our first game and just signed up with inneractive so really all we have left is just coding for the ads. The problem i have is the ad takes up a lot of real estate and i would like to be able to adjust the GUI when there is no ad displayed so there is not just a blank spot. Pretty much just like angry birds does it, the high score and score move back into place when the ad is not displayed on screen. Im sure this is not just for inneractive so you can move this to better forum if you need to. So my question is, is there some function that will return true or variable that will return true or false depending on if the ad is displayed or not? [import]uid: 126161 topic_id: 22185 reply_id: 322185[/import]

I have continued looking and still can’t find anything, any advise? [import]uid: 126161 topic_id: 22185 reply_id: 88508[/import]

The ads.init() function supports a Lua listener which will inform your code if an ad was successfully received or not. Please see sample app “Ads\inneractive” that is included with the Corona SDK for an example on how to do this. Notice that the adListener() function does what you want. Good luck! [import]uid: 32256 topic_id: 22185 reply_id: 88510[/import]

Thank you for your response it was very helpful, i knew about the listener function but since i am using ads.init in main.lua it did not seem useful to use the listener since the objects i wanted to move were locals in a different .lua file. What i was needing was the event.isError listener, i was not aware of that, why isn’t it in the API? I ended up just making a global _G.adError in main.lua to tell when when the ad fails and to move the score and highscore in the levels when the ad fails using a timer

main.lua
[lua]ads = require (“ads”)
–Ads
local function adListener( event )
if event.isError then
_G.adError = true
else
_G.adError = false
end
end
ads.init( “inneractive”, “Ad Id”, adListener )[/lua]

Level File
[lua]local function checkAds ()
if _G.adError == true then
levelTrans.scoreTrans1 = transition.to (scoreTxt, {time = 500, delay = 0, y = 10, x = 345})
levelTrans.highTrans1 = transition.to (highTxt, {time = 500, delay = 0, y = 30, x = 380})
elseif _G.adError == false then
levelTrans.scoreTrans2 = transition.to (scoreTxt, {time = 500, delay = 0, y = 65, x = 300})
levelTrans.highTrans2 = transition.to (highTxt, {time = 500, delay = 0, y = 65, x = 400})
end
end
local adsTimer = timer.performWithDelay ( 1, checkAds, -1)[/lua]

Thanks for your help in finding the event.isError function! [import]uid: 126161 topic_id: 22185 reply_id: 88617[/import]

Glad I could help.
Updating the API documentation is on our queue. We know we’re behind on the documentation. So much to do, so little time. [import]uid: 32256 topic_id: 22185 reply_id: 88691[/import]

I just updated our API documentation now. I hope this helps. [import]uid: 32256 topic_id: 22185 reply_id: 88709[/import]

Thank you for all your help and fast responses. I appreciate it. and yes it helped out a lot. [import]uid: 126161 topic_id: 22185 reply_id: 88756[/import]

Are there any other parameters besides event.isError?
Sometimes inneractive ads will fail to display, but will block all the touches. This is especially painful when full screen ad is displayed. You don’t see anything, it’s completely transparent, yet it acts as an invisible wall between the game and the user.
It’s not obvious for the user to use the back button to hide the ad which they don’t see.
How can we detect this sort of situation? or prevent it? [import]uid: 52103 topic_id: 22185 reply_id: 92770[/import]

vitalyx,

Is this issue happening to you on iOS? This touch issue does not happen on Android for me. [import]uid: 32256 topic_id: 22185 reply_id: 92856[/import]

I second the request for additional parameters besides event.isError. I’ve been knocking my head against a wall trying to figure out how to tell when Inmobi has a valid connection but no ad to provide, so I can swap in a house ad. Event.isError is not helpful when the cause of an absent ad is lack of inventory rather than a technical problem.

My endgame at this point is just to display an image under the ad web popup at all times (since I can’t tell when there’s an ad and when there isn’t) but that seems like a waste of memory. [import]uid: 1560 topic_id: 22185 reply_id: 93915[/import]

Hoping to resurrect this old thread as I am experiencing similar issues as vitalyx in respect to ad calls “blocking” touches in the area of the ad (even if ad fails to load).

This is only happening for me on iOS, on Android when an ad fails my listener function catches it and loads my house ad just fine. However on iOS when an ad fails it will display my house ad as it should but I am unable to click on it (or any other object I place within the same space as the ad unit).

I am using inMobi ads if that info is helpful, haven’t tried with inneractive.

Is this a known bug or something I am doing incorrectly? I can post my code if needed.

Thanks

[import]uid: 5786 topic_id: 22185 reply_id: 114836[/import]

This is a know issue on iOS. It is possible for us to work-around it on our end, just like we did on Android. The bug number is #7821. [import]uid: 32256 topic_id: 22185 reply_id: 114853[/import]