Android / admob: Closing the interstitial ad closes the app(!)

This code worked before upgrading to 2013.2100:

   local ads = require "ads"     local function adListener( event )         if event.isError then             -- Failed to receive an ad.             print("error fetching ad: ",msg)         end     end     ads.init( "admob", myAppID, adListener )     ads.show( "interstitial", { x=0, y=0 } )  

Where myAppID is the 15-character alphanumeric string. The ad shows fine, the x hilights on touch, but when the ad closes I’m at the phone’s home screen.

Going by that the only line of code is in my applicationSuspend handler, I commented it out and it no longer closes the app when you close the ad. So it would seem a suspend system even is triggered in the new Corona build when closing ads.

local function onSystemEvent(event)     if event.type == "applicationSuspend" then         --native.requestExit()    --only does something on Android - safe to run this line even on Apple     end end  

Any ideas on how to close the app on suspend and still make the ads work as normal? This would be optimal for us.

Specifically, I get a system event of type applicationSuspend after the app is closed, and *BEFORE* I get the adListener event.response “The ad loaded successfully!”. This is good, because it allows me to skip my exit-on-suspend until I’ve received the okay from the ad being closed. But if this bug is fixed, or if I never get the okay, the user will get an ad-free app.

I have set an AD_SHOWING flag at ads.show and clear it as soon as the user touches a control. This is tested working.

I’ve filed the bug.

henrik5,

Thanks for your posts.  I have run into a brick wall about interstitial ads.  How do you make your game/app continue from its current position after the interstitial ad is loaded and closed?  

I use admob interstitial ad and once the ad shows and clicked to close, the game “always” reloads from the beginning.  I tried something similar to what you have up there but my game still reloads from beginning.

Any thoughts?

On a side note, I know Corona is still probably very new but it’s kinda sad when there are very little help in the forum.  I don’t know if most people don’t know the answer to these questions (which I think is the case), but it would be very helpful if some staff members could just point out something to assist.  Oh well…continue digging.

Thanks.

Christian

Well, if as in my case you can close ads okay if you comment out the suspend event handling code, you can definitely do the same patch as me.

Perhaps I should do that.  Let me add that line of code in there and see what it does.

But I forgot to ask you if you’re using iPhone or Android.  Mine is on an Android.  I suppose it shouldn’t matter?

Again, thanks.

-Christian

Going by that the only line of code is in my applicationSuspend handler, I commented it out and it no longer closes the app when you close the ad. So it would seem a suspend system even is triggered in the new Corona build when closing ads.

local function onSystemEvent(event)     if event.type == "applicationSuspend" then         --native.requestExit()    --only does something on Android - safe to run this line even on Apple     end end  

Any ideas on how to close the app on suspend and still make the ads work as normal? This would be optimal for us.

Specifically, I get a system event of type applicationSuspend after the app is closed, and *BEFORE* I get the adListener event.response “The ad loaded successfully!”. This is good, because it allows me to skip my exit-on-suspend until I’ve received the okay from the ad being closed. But if this bug is fixed, or if I never get the okay, the user will get an ad-free app.

I have set an AD_SHOWING flag at ads.show and clear it as soon as the user touches a control. This is tested working.

I’ve filed the bug.

henrik5,

Thanks for your posts.  I have run into a brick wall about interstitial ads.  How do you make your game/app continue from its current position after the interstitial ad is loaded and closed?  

I use admob interstitial ad and once the ad shows and clicked to close, the game “always” reloads from the beginning.  I tried something similar to what you have up there but my game still reloads from beginning.

Any thoughts?

On a side note, I know Corona is still probably very new but it’s kinda sad when there are very little help in the forum.  I don’t know if most people don’t know the answer to these questions (which I think is the case), but it would be very helpful if some staff members could just point out something to assist.  Oh well…continue digging.

Thanks.

Christian

Well, if as in my case you can close ads okay if you comment out the suspend event handling code, you can definitely do the same patch as me.

Perhaps I should do that.  Let me add that line of code in there and see what it does.

But I forgot to ask you if you’re using iPhone or Android.  Mine is on an Android.  I suppose it shouldn’t matter?

Again, thanks.

-Christian