2 days ago ads from admob work perfectly fine on my device, I don’t know why today it disappeared. I checked the codes and modify them but nothing changed. Corona ads show up normally, but when I tried coronaAds.hide() then it disappeared forever. After I reopen the app, I can’t see Corona ads anymore (the ads only appeared for the first time, after coronaAds.hide() execute then the ads never come back). I show Corona ads in scene:create and hide ads in scene:hide (phase==“did”). If you know what’s wrong please help me…
I would not call coronaAds.show() in scene:create(). Because we want to cache scenes with composer, if the scene still exists, it won’t get run a second time. You’re best to call coronaAds.show() in the scene:show()'s “did” phase. and call coronaAds.hide() in the scene:hide()'s “will” phase.
Rob
Thank you very much for your reply, I’ll try again.
function scene:show(event) local sceneGroup = self.view local phase = event.phase if ( phase == "will" ) then -- Code here runs when the scene is still off screen (but is about to come on screen) elseif ( phase == "did" ) then -- Code here runs when the scene is entirely on screen composer.removeScene("stage") local bannerPlacement = "bottom-banner-320x50" coronaAds.init( "697ed210-----------------------") coronaAds.show( bannerPlacement, false ) end end -- hide() function scene:hide( event ) local sceneGroup = self.view local phase = event.phase if ( phase == "will" ) then -- Code here runs when the scene is on screen (but is about to go off screen) coronaAds.hide() elseif ( phase == "did" ) then end end
unluckily I couldn’t get it to work. Sometimes the banner shows up, sometimes it doesn’t, when changing to next scene the app freezes…
You really should only call .init() once and the best place to do that is your main.lua.
Next, you should have a listener function that gets called on ad events. It’s important that at least during testing you put some print statements in that function to printout the event table, perhaps something like:
print( json.prettify( event ) )
Of course you have to require the json module at the top. Then look at the console log for the device (if it’s tethered and you had Corona SDK install it after the build, they will show in the console window!) and see what error messages you’re getting.
It’s likely that you’re seeing a low fill rate. We are working to get Corona Ads to a 100% fill rate, but for now, depending on different factors, like location, time for the ad providers to learn about you, etc. you might simply not have any inventory available to you. But you won’t know until you can see what messages are being returned from the server.
Rob
Thanks, your answer is very useful. I’ve just figured out that the app freezes problem doesn’t related to ads. I removed the ads, test apk file in my device, it still freezes. Several days ago I built many apk files, all of them worked fine, but now I test them again, none of them work. The apk file I’ve just built or the old apk files from several days ago strangely frozen when changing to gameover scene. After I closed the game and start again, they work fine. This never happens before to the old apk files. What could be the problem? Is it because I upload apk file to google play alpha channel(?), or because apk files built from Corona 2016.2902 no longer work? I tested it in other devices and got same result. This is really confusing… Do you have any ideas why?
It would be really helpful to know more about the problem.
What build of Corona last worked for you?
What build did it stop working for you?
Does going back to a previous build of Corona get you working again?
Rob
Sorry English is not my mother tongue language so I may not express my problem properly. To put it simpler:
Several days ago: Corona build 2016.2902 -> all apk files worked fine on android.
Today: Corona build 2016.2902 -> new apk files frozen while changing to gameover scene on android, old apk files are the same. After I close the game and start again, everything is fine. -> this is really confusing.
So I couldn’t understand what’s wrong here, I try other devices -> same result. Download latest Corona daily build -> same result. On simulator it works fine, and old apk files used to work fine… So I suspect the problem was because I uploaded apk file to google alpha test, but that may not be the case… ?
I’m working on android debug bridge to figure out the problem (no matter which methods I use, it still doesn’t recognize my device :o )
Please let me know what the problem could be… What happened to the apk files?
Update:
Well, I don’t know why and how but it works now, I modify the code a little and seems like my device accepts the new code…?
Thank you very much for your patience :) I may made some stupid mistakes without knowing it, or the server/internet was not working right, whatever it is, everything is fine now.
I would not call coronaAds.show() in scene:create(). Because we want to cache scenes with composer, if the scene still exists, it won’t get run a second time. You’re best to call coronaAds.show() in the scene:show()'s “did” phase. and call coronaAds.hide() in the scene:hide()'s “will” phase.
Rob
Thank you very much for your reply, I’ll try again.
function scene:show(event) local sceneGroup = self.view local phase = event.phase if ( phase == "will" ) then -- Code here runs when the scene is still off screen (but is about to come on screen) elseif ( phase == "did" ) then -- Code here runs when the scene is entirely on screen composer.removeScene("stage") local bannerPlacement = "bottom-banner-320x50" coronaAds.init( "697ed210-----------------------") coronaAds.show( bannerPlacement, false ) end end -- hide() function scene:hide( event ) local sceneGroup = self.view local phase = event.phase if ( phase == "will" ) then -- Code here runs when the scene is on screen (but is about to go off screen) coronaAds.hide() elseif ( phase == "did" ) then end end
unluckily I couldn’t get it to work. Sometimes the banner shows up, sometimes it doesn’t, when changing to next scene the app freezes…
You really should only call .init() once and the best place to do that is your main.lua.
Next, you should have a listener function that gets called on ad events. It’s important that at least during testing you put some print statements in that function to printout the event table, perhaps something like:
print( json.prettify( event ) )
Of course you have to require the json module at the top. Then look at the console log for the device (if it’s tethered and you had Corona SDK install it after the build, they will show in the console window!) and see what error messages you’re getting.
It’s likely that you’re seeing a low fill rate. We are working to get Corona Ads to a 100% fill rate, but for now, depending on different factors, like location, time for the ad providers to learn about you, etc. you might simply not have any inventory available to you. But you won’t know until you can see what messages are being returned from the server.
Rob
Thanks, your answer is very useful. I’ve just figured out that the app freezes problem doesn’t related to ads. I removed the ads, test apk file in my device, it still freezes. Several days ago I built many apk files, all of them worked fine, but now I test them again, none of them work. The apk file I’ve just built or the old apk files from several days ago strangely frozen when changing to gameover scene. After I closed the game and start again, they work fine. This never happens before to the old apk files. What could be the problem? Is it because I upload apk file to google play alpha channel(?), or because apk files built from Corona 2016.2902 no longer work? I tested it in other devices and got same result. This is really confusing… Do you have any ideas why?
It would be really helpful to know more about the problem.
What build of Corona last worked for you?
What build did it stop working for you?
Does going back to a previous build of Corona get you working again?
Rob
Sorry English is not my mother tongue language so I may not express my problem properly. To put it simpler:
Several days ago: Corona build 2016.2902 -> all apk files worked fine on android.
Today: Corona build 2016.2902 -> new apk files frozen while changing to gameover scene on android, old apk files are the same. After I close the game and start again, everything is fine. -> this is really confusing.
So I couldn’t understand what’s wrong here, I try other devices -> same result. Download latest Corona daily build -> same result. On simulator it works fine, and old apk files used to work fine… So I suspect the problem was because I uploaded apk file to google alpha test, but that may not be the case… ?
I’m working on android debug bridge to figure out the problem (no matter which methods I use, it still doesn’t recognize my device :o )
Please let me know what the problem could be… What happened to the apk files?
Update:
Well, I don’t know why and how but it works now, I modify the code a little and seems like my device accepts the new code…?
Thank you very much for your patience :) I may made some stupid mistakes without knowing it, or the server/internet was not working right, whatever it is, everything is fine now.