ADMOB, integrate both banner and interstitual issue

Thanks!  Will give this a try.

This worked thanks, but when an interstitial comes up, it removes the banner ad.  I have it calling a new banner ad when the interstitial comes up to replace it.  No way to say do it when the interstitial closes, so I just have it next line.  Kind of kludgy how it all comes together.

yes, showing one hides the other. I have been using ads.hide() as well before displaying another ad. not sure if its needed or not.

One way of having some control over when to show a banner ad again after a fullscreen would be to have a timer that starts when the fullscreen ad is loaded. Say a timer of 10s and then you hide the ad incase its still up and show a banner ad.

hopefully we will get some way of knowing when a fullscreen has been closed in the future. that and the possibility of preloading a fullscreen before showing it.

Good info, this is the thread I was looking for. Was testing adMob and was having similar issues. Now I don’t need to use ads.hide(), and just use ads.show() when swapping between the banner and interstitial ads. 

Good info, this is the thread I was looking for. Was testing adMob and was having similar issues. Now I don’t need to use ads.hide(), and just use ads.show() when swapping between the banner and interstitial ads. 

It would be a big help to have a way of knowing when the interstitial has been closed.  I’m having some inconsistencies keeping both running together.  Without adding artificial delays after internstitual to guess when they close it, it is not reliable.

Hello.

I was writing to ask something else, but while I typed I realized what the problem was ( appID instead of appId) so, since I’m already writing I’d like to ask about something elseknow if someone else has stumbled upon this matter.

I was given an App and I am required to show an interstitial ad when the user exits the main menu, and a banner during the game. However, given the way the app is coded the menu and the game ar not separate scenes, the menu is just faded away and, after a delay, the game scenario is drawn. so, I request the interstitial ad with ads.show(…) right before the stage is drawn:

      if sysEnv ~= "simulator" then             interstitialRequested=true             bannerRequested=false             showAd("interstitial","ca-app-pub-3488871943634227/7927423395",display.screenOriginY)         end         timer.performWithDelay(3000, gameStage, 1)

The 3 seconds delay works just fine the 2nd, 3rd, and so on time that I call the ad. But, the first time the ad is called it takes a time longer than that, so the game loads, starts at a low frame rate, and a few seconds later is interrupted by the ad.

So, I tried to use something like this:

       if sysEnv ~= "simulator" then             interstitialRequested=true             bannerRequested=false             showAd("interstitial","ca-app-pub-3488871943634227/7927423395",display.screenOriginY)         end while(adNotLoaded) do   --pointless instruction end         timer.performWithDelay(1000, gameStage, 1)

But it just causes the app to crash, and apparently the loop prevents the ad to load.

I could just use a larger delay the first time, but I don’t like that  solution, as I don’t really know how long it will take for the ad to load each time and if it loads too late, the game looks bad and laggy, and the banner doesn’t show.

So, is there a way to pause or halt the app until the adlistener is called (obviously without preventing the ad from loading)

Thanks for your time

I look forward to using the ads.height() function.  When will it be available in a public build?  I have my app setup to use AdMob, but if the height isn’t going to be gettable for a few weeks, I would want to look into different options.

The key problem you seem to be having, and the one I am having is there is no way to know when an interstitial is closed and it is safe to turn on the banner again.

We don’t have an ETA on a new public build yet.

Rob

Any updates?  I’m only running Admob banners and would like to keep banners and interstitials all through Admob.

Not yet.

I manage to use AdMob banners and interstitials (risky as my AdMob a/c may get pulled anytime http://forums.coronalabs.com/topic/48788-google-play-account-terminated/)

Here’s my ad listener code:

local function AdCallback(event) --[[print("\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*") print("event.response = " .. tostring(event.response)) print("event.provider = " .. tostring(event.provider)) print("event.isError = " .. tostring(event.isError)) print("event.type = " .. tostring(event.type)) print("event.name = " .. tostring(event.name)) print("loadRequested ", loadRequested) print("\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*") --]] if event.provider == "AdMobProvider" then if interstitialRequested then interstitialRequested = false if not simulator then --timer.performWithDelay(1000, function() loadRequested = true ads.load("interstitial", {appId = "ca-app-pub-x/y", testMode = adMobTestMode}) --end, 1) end elseif loadRequested then loadRequested = false else -- Banner. if event.isError then --print("AdMob banner not successful") bannerVisible = false else --print("AdMob banner successful") bannerVisible = true end end else -- Vungle.

In conjunction with:

bannerVisible = false ads.hide()

and:

interstitialRequested = true ads.show("interstitial", {appId = "ca-app-pub-x/y", testMode = adMobTestMode}) 

and:

if not disableAds and not bannerVisible then ads.show("banner", {x = Screen.left, y = Screen.height, testMode = adMobTestMode}) end

I can easily mix AdMob banners and interstitials.

The only tricky part is the last bit of code shown immediately above. You’ll need a convenient “trigger” point in the app to perform the test. You could just go ahead and call ads,show(“banner” …) but that will, in my experience, result in a flicker as the banner is redisplayed.

Good luck!

MAS1

I no longer use this code - it’s deprecated.

It would be a big help to have a way of knowing when the interstitial has been closed.  I’m having some inconsistencies keeping both running together.  Without adding artificial delays after internstitual to guess when they close it, it is not reliable.

I haven’t tested this yet but all I want is one interstitual right after the open of the app, then run a banner from then on.  In the past I had a problem with the time it took for Admob interstituals to load.  It could take 5-20 seconds to open and in the mean time, the user could have navigated to multilple places.  Have the Admob interstituals gotten better with loading for you?

Yes - interstitials used to take an arbitrary time to display from a call to ads.show().

With ads.load() and ads.show() that problem is fixed. I’ve only used AdMob on Android so far.

Well, I got it figured out and it was easier then I thought.  I think my solution was helped since I am using a storyboard setup.  I have a spash/title screen that call the interstitial from.

[lua]local ads = require( “ads” )

–Ads

ads.init( “admob”, “ca-app-pub-xxxxx”, adListener )

ads.show( “interstitial”)[/lua]

Then on the page right after this, I used an ads.hide and another ad.show but not ads.init and put the appID in the new ads.show.

[lua]local ads = require( “ads” )

–Add Banner Ad

ads.hide()

ads.show( “banner”, {appId =“ca-app-pub-yyyy”,  x = 0, y = 480 } )[/lua]

Admob intersitials are loading much faster now, 2-3 seconds it seems.  

Hello.

I was writing to ask something else, but while I typed I realized what the problem was ( appID instead of appId) so, since I’m already writing I’d like to ask about something elseknow if someone else has stumbled upon this matter.

I was given an App and I am required to show an interstitial ad when the user exits the main menu, and a banner during the game. However, given the way the app is coded the menu and the game ar not separate scenes, the menu is just faded away and, after a delay, the game scenario is drawn. so, I request the interstitial ad with ads.show(…) right before the stage is drawn:

      if sysEnv ~= "simulator" then             interstitialRequested=true             bannerRequested=false             showAd("interstitial","ca-app-pub-3488871943634227/7927423395",display.screenOriginY)         end         timer.performWithDelay(3000, gameStage, 1)

The 3 seconds delay works just fine the 2nd, 3rd, and so on time that I call the ad. But, the first time the ad is called it takes a time longer than that, so the game loads, starts at a low frame rate, and a few seconds later is interrupted by the ad.

So, I tried to use something like this:

       if sysEnv ~= "simulator" then             interstitialRequested=true             bannerRequested=false             showAd("interstitial","ca-app-pub-3488871943634227/7927423395",display.screenOriginY)         end while(adNotLoaded) do   --pointless instruction end         timer.performWithDelay(1000, gameStage, 1)

But it just causes the app to crash, and apparently the loop prevents the ad to load.

I could just use a larger delay the first time, but I don’t like that  solution, as I don’t really know how long it will take for the ad to load each time and if it loads too late, the game looks bad and laggy, and the banner doesn’t show.

So, is there a way to pause or halt the app until the adlistener is called (obviously without preventing the ad from loading)

Thanks for your time

I look forward to using the ads.height() function.  When will it be available in a public build?  I have my app setup to use AdMob, but if the height isn’t going to be gettable for a few weeks, I would want to look into different options.

The key problem you seem to be having, and the one I am having is there is no way to know when an interstitial is closed and it is safe to turn on the banner again.