how to display ads at the bottom

Hello,

I am using this code to display iAds. But cannot the ads are not really at the bottom:

<code>

function displayAd (pos)

    if (pos == “bottom”) then

        local adY = display.contentHeight - display.screenOriginY - 66

        

        if system.getInfo (“model”) ~= “iPad” then

            adY = display.contentHeight - display.screenOriginY - 50

        end

        ads.show (“banner”, {x=originx, y=adY})

    end

end

</code>

Anyone has a solution?

Have you tried putting the & value way off screen, like y = 10000?  The ads software should then bring things back on screen.

Rob

Have you tried putting the & value way off screen, like y = 10000?  The ads software should then bring things back on screen.

Rob

Hi, I’m currently having the same problem and when I give it a value much higher than the screen height the ad does not get pulled onto the screen. Matt

In fact, on an iPhone 5s with config of 640x960 I have to use a y value of 520 to get the inneractive ads at the bottom of the screen. I was expecting to use a calculation of screen size minus ad banner height. What coordinate system do the ads use?

I just tried to do the +10000 trick and it’s not putting the ad back on the page where it belongs.   Setting y to display.contentHeight - 25 seemed to position a banner at the bottom of the page on my iPhone 6.

I’ll check with Engineering about the bottom positioning.

Rob

This was an iOS 8 issue for landscape based apps.  It has been fixed.  Setting the Y to 10000 now positions the ad correctly at the bottom.

Rob

Unfortunately, I don’t believe the fix is working.

-------------------------------------------------------------------------------- -- Sample code is MIT licensed, see http://www.coronalabs.com/links/code/license -- Copyright (C) 2013 Corona Labs Inc. All Rights Reserved. -------------------------------------------------------------------------------- -------------------------------------------------------------------------------- -- Setup -------------------------------------------------------------------------------- -- Hide the status bar display.setStatusBar( display.HiddenStatusBar ) -- Load Corona 'ads' library local ads = require( "ads" ) -------------------------------------------------------------------------------- -- Setup ad provider -------------------------------------------------------------------------------- -- The name of the ad provider. local provider = "admob" -- Your Android application ID local bannerAppID = "ca-app-pub-5387163376908424/8846800273" local interstitialAppID = "ca-app-pub-5387163376908424/8581371075" if system.getInfo("platformName") == "iPhone OS" then &nbsp;&nbsp; &nbsp;-- Your iOS application IDs &nbsp;&nbsp; &nbsp;intersititalAppID = "ca-app-pub-5387163376908424/5741649076 " &nbsp;&nbsp; &nbsp;bannerAppID = "ca-app-pub-5387163376908424/4264915871" end function print\_r ( t ) &nbsp;&nbsp;&nbsp; local print\_r\_cache={} &nbsp;&nbsp;&nbsp; local function sub\_print\_r(t,indent) &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if (print\_r\_cache[tostring(t)]) then &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; print(indent.."\*"..tostring(t)) &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; else &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; print\_r\_cache[tostring(t)]=true &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if (type(t)=="table") then &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; for pos,val in pairs(t) do &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if (type(val)=="table") then &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; print(indent.."["..pos.."] =\> "..tostring(t).." {") &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; sub\_print\_r(val,indent..string.rep(" ",string.len(pos)+8)) &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; print(indent..string.rep(" ",string.len(pos)+6).."}") &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; elseif (type(val)=="string") then &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; print(indent.."["..pos..'] =\> "'..val..'"') &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; else &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; print(indent.."["..pos.."] =\> "..tostring(val)) &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; end &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; end &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; else &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; print(indent..tostring(t)) &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; end &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; end &nbsp;&nbsp;&nbsp; end &nbsp;&nbsp;&nbsp; if (type(t)=="table") then &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; print(tostring(t).." {") &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; sub\_print\_r(t,"&nbsp; ") &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; print("}") &nbsp;&nbsp;&nbsp; else &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; sub\_print\_r(t,"&nbsp; ") &nbsp;&nbsp;&nbsp; end &nbsp;&nbsp;&nbsp; print() end -- create a background for the app local background = display.newRect( 0, 0, display.contentWidth, display.contentHeight ) background.anchorX = 0 background.anchorY = 0 background:setFillColor( 0, 0, 0.5 ) -- Create a text object to display ad status local statusText = display.newText( "", 0, 0, native.systemFontBold, 22 ) statusText:setFillColor( 255 ) statusText.x, statusText.y = display.contentWidth \* 0.5, 160 -- Set up ad listener. local function adListener( event ) &nbsp;&nbsp; &nbsp;-- event table includes: &nbsp;&nbsp; &nbsp;-- &nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;event.provider &nbsp;&nbsp; &nbsp;--&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;event.isError (e.g. true/false ) &nbsp;&nbsp; &nbsp;print\_r(event) &nbsp;&nbsp; &nbsp;local msg = event.response &nbsp;&nbsp; &nbsp;-- just a quick debug message to check what response we got from the library &nbsp;&nbsp; &nbsp;print("Message received from the ads library: ", msg) &nbsp;&nbsp; &nbsp;if event.isError then &nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;statusText:setFillColor( 1, 0, 0 ) &nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;statusText.text = "Error Loading Ad" &nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;statusText.x = display.contentWidth \* 0.5 &nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;showAd( "banner", appID ) &nbsp;&nbsp; &nbsp;else &nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;statusText:setFillColor( 0, 1, 0 ) &nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;statusText.text = "Successfully Loaded Ad" &nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;statusText.x = display.contentWidth \* 0.5 &nbsp;&nbsp; &nbsp;end end -- Initialize the 'ads' library with the provider you wish to use. local appID = bannerAppID if not bannerAppID then &nbsp;&nbsp; &nbsp;appID = interstitalAppID end ads.init( provider, appID, adListener ) local function showBannerAd() &nbsp;&nbsp; &nbsp;ads.show("banner", { appId = bannerAppID, testMode = true }) end local function preloadInterstitialAd() &nbsp;&nbsp; &nbsp;ads.load("interstital", { appId = intersititalAppID, testMode = true }) end local function showInterstitialAd() &nbsp;&nbsp; &nbsp;ads.show() end local function showInterstitial() &nbsp;&nbsp; &nbsp;print("checking to see if the interstital is ready") &nbsp;&nbsp; &nbsp;if ads.isLoaded("interstitial") then &nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;print("showing the interstitial") &nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;ads.show("interstitial", { appId = interstitialAppID, testMode = true }) &nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;timer.cancel(showAdTimer) &nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;showAdTimer = nil &nbsp;&nbsp; &nbsp;end end local function changeAds() &nbsp;&nbsp; &nbsp;print("changing ad types") &nbsp;&nbsp;&nbsp; ads.hide() &nbsp;&nbsp;&nbsp; -- &nbsp;&nbsp;&nbsp; -- use the ads.show() to test just showing an interstitial &nbsp;&nbsp;&nbsp; -- use the ads.load() to test using ad.load() &nbsp;&nbsp;&nbsp; -- &nbsp;&nbsp;&nbsp; --ads.show("interstitial", { appId = interstitialAppID, testMode = true } ) &nbsp;&nbsp;&nbsp; ads.load("interstitial", { appId = interstitialAppID, testMode = true } ) &nbsp;&nbsp;&nbsp; showAdTimer = timer.performWithDelay(100, showInterstitial,0) end -------------------------------------------------------------------------------- -- UI -------------------------------------------------------------------------------- -- initial variables local sysModel = system.getInfo("model") local sysEnv = system.getInfo("environment") -- Shows a specific type of ad showAd = function( adType, vendorAppID ) &nbsp;&nbsp; &nbsp;local adX, adY = 0, display.contentHeight + 10000 &nbsp;&nbsp; &nbsp;statusText.text = "Showing " .. adType &nbsp;&nbsp; &nbsp;ads.show( adType, { x=adX, y=adY, appId=vendorAppID, testMode = true } ) end -- if on simulator, let user know they must build for device if sysEnv == "simulator" then &nbsp;&nbsp; &nbsp;local font, size = native.systemFontBold, 22 &nbsp;&nbsp; &nbsp;local warningText = display.newRetinaText( "Please build for device or Xcode simulator to test this sample.", 0, 0, 290, 300, font, size ) &nbsp;&nbsp; &nbsp;warningText:setTextColor( 1 ) &nbsp;&nbsp; &nbsp;warningText.x, warningText.y = display.contentWidth \* 0.5, display.contentHeight \* 0.5 else &nbsp;&nbsp; &nbsp;-- start with banner ad &nbsp;&nbsp; &nbsp;showAd( "banner", appID ) &nbsp;&nbsp;&nbsp; timer.performWithDelay(15000, changeAds, 1) end local function onSystemEvent( event ) &nbsp;&nbsp;&nbsp; print( "System event name and type: " .. event.name, event.type ) &nbsp;&nbsp;&nbsp; if event.type == "applicationResume" and isInterstitialShowing then &nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;print("The ad closed") &nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;showBannerAd() &nbsp;&nbsp;&nbsp; end end Runtime:addEventListener( "system", onSystemEvent )

Just built and tested on my iPhone 6 yesterday morning.

This is all I see in the sim:

00000148.png

I see the same on device, too.

Ok, some questions…

  1. Does the y position of the ad need to be display.contentHeight plus 10,000 ?
  2. Should the code above work as is?
  3. You mentioned the problem was for landscape apps - is there a similar issue with portrait, as that is where I’m seeing a problem?
  4. Do I need to update to XCode latest and/or Yosemite?
  5. Which daily build did the fix go into (aka, is it available yet?)
  6. I’m using inneractive, which does not appear to have a load() function: http://docs.coronalabs.com/daily/plugin/ads-inneractive/index.html Am I doing something wrong?
  7. Do ads need to be preloaded before they can be shown?

This is all very odd because I was seeing ads recently, while using daily 2467 I think (not sure), but now they are gone again, in build 2468.

Thanks,

Matt

1.  No, it just needs to be off screen

2.  Yes.  It was working yesterday morning.  Of course you have to have AdMob setup properly.  I see I left my values in there.  Since you’re not building with my bundle ID you probably won’t get ads if you used those AdMob values.

  1. I didn’t try portrait, but my understanding it was impacting landscape apps only.

  2. No

  3. The fix was in the AdMob plugin, so it should be available to everyone.

  4. This is likely your problem.  This is an AdMob and iAds hack.  I don’t know if other Ad providers will use this.  The problem with AdMob and iAds is variable height ads making it difficult to position things at the bottom.  If you’re using inneractive, their ads should be a predictable fixed height and you shouldn’t need this trick.

  5. No, but for AdMob interstitials, they can take a while to download, so preloading them is a good thing.

I also don’t know if AdMob works in the simulator, I don’t think it does.  I know iAds doesn’t.

Rob

Yea. It works on my iPad. Setting the y-position to 10000 will cause the adMob to appear at the bottom of the screen nicely.

Hi, I’m currently having the same problem and when I give it a value much higher than the screen height the ad does not get pulled onto the screen. Matt

In fact, on an iPhone 5s with config of 640x960 I have to use a y value of 520 to get the inneractive ads at the bottom of the screen. I was expecting to use a calculation of screen size minus ad banner height. What coordinate system do the ads use?

I just tried to do the +10000 trick and it’s not putting the ad back on the page where it belongs.   Setting y to display.contentHeight - 25 seemed to position a banner at the bottom of the page on my iPhone 6.

I’ll check with Engineering about the bottom positioning.

Rob

This was an iOS 8 issue for landscape based apps.  It has been fixed.  Setting the Y to 10000 now positions the ad correctly at the bottom.

Rob

Unfortunately, I don’t believe the fix is working.

-------------------------------------------------------------------------------- -- Sample code is MIT licensed, see http://www.coronalabs.com/links/code/license -- Copyright (C) 2013 Corona Labs Inc. All Rights Reserved. -------------------------------------------------------------------------------- -------------------------------------------------------------------------------- -- Setup -------------------------------------------------------------------------------- -- Hide the status bar display.setStatusBar( display.HiddenStatusBar ) -- Load Corona 'ads' library local ads = require( "ads" ) -------------------------------------------------------------------------------- -- Setup ad provider -------------------------------------------------------------------------------- -- The name of the ad provider. local provider = "admob" -- Your Android application ID local bannerAppID = "ca-app-pub-5387163376908424/8846800273" local interstitialAppID = "ca-app-pub-5387163376908424/8581371075" if system.getInfo("platformName") == "iPhone OS" then &nbsp;&nbsp; &nbsp;-- Your iOS application IDs &nbsp;&nbsp; &nbsp;intersititalAppID = "ca-app-pub-5387163376908424/5741649076 " &nbsp;&nbsp; &nbsp;bannerAppID = "ca-app-pub-5387163376908424/4264915871" end function print\_r ( t ) &nbsp;&nbsp;&nbsp; local print\_r\_cache={} &nbsp;&nbsp;&nbsp; local function sub\_print\_r(t,indent) &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if (print\_r\_cache[tostring(t)]) then &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; print(indent.."\*"..tostring(t)) &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; else &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; print\_r\_cache[tostring(t)]=true &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if (type(t)=="table") then &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; for pos,val in pairs(t) do &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if (type(val)=="table") then &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; print(indent.."["..pos.."] =\> "..tostring(t).." {") &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; sub\_print\_r(val,indent..string.rep(" ",string.len(pos)+8)) &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; print(indent..string.rep(" ",string.len(pos)+6).."}") &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; elseif (type(val)=="string") then &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; print(indent.."["..pos..'] =\> "'..val..'"') &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; else &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; print(indent.."["..pos.."] =\> "..tostring(val)) &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; end &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; end &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; else &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; print(indent..tostring(t)) &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; end &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; end &nbsp;&nbsp;&nbsp; end &nbsp;&nbsp;&nbsp; if (type(t)=="table") then &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; print(tostring(t).." {") &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; sub\_print\_r(t,"&nbsp; ") &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; print("}") &nbsp;&nbsp;&nbsp; else &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; sub\_print\_r(t,"&nbsp; ") &nbsp;&nbsp;&nbsp; end &nbsp;&nbsp;&nbsp; print() end -- create a background for the app local background = display.newRect( 0, 0, display.contentWidth, display.contentHeight ) background.anchorX = 0 background.anchorY = 0 background:setFillColor( 0, 0, 0.5 ) -- Create a text object to display ad status local statusText = display.newText( "", 0, 0, native.systemFontBold, 22 ) statusText:setFillColor( 255 ) statusText.x, statusText.y = display.contentWidth \* 0.5, 160 -- Set up ad listener. local function adListener( event ) &nbsp;&nbsp; &nbsp;-- event table includes: &nbsp;&nbsp; &nbsp;-- &nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;event.provider &nbsp;&nbsp; &nbsp;--&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;event.isError (e.g. true/false ) &nbsp;&nbsp; &nbsp;print\_r(event) &nbsp;&nbsp; &nbsp;local msg = event.response &nbsp;&nbsp; &nbsp;-- just a quick debug message to check what response we got from the library &nbsp;&nbsp; &nbsp;print("Message received from the ads library: ", msg) &nbsp;&nbsp; &nbsp;if event.isError then &nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;statusText:setFillColor( 1, 0, 0 ) &nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;statusText.text = "Error Loading Ad" &nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;statusText.x = display.contentWidth \* 0.5 &nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;showAd( "banner", appID ) &nbsp;&nbsp; &nbsp;else &nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;statusText:setFillColor( 0, 1, 0 ) &nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;statusText.text = "Successfully Loaded Ad" &nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;statusText.x = display.contentWidth \* 0.5 &nbsp;&nbsp; &nbsp;end end -- Initialize the 'ads' library with the provider you wish to use. local appID = bannerAppID if not bannerAppID then &nbsp;&nbsp; &nbsp;appID = interstitalAppID end ads.init( provider, appID, adListener ) local function showBannerAd() &nbsp;&nbsp; &nbsp;ads.show("banner", { appId = bannerAppID, testMode = true }) end local function preloadInterstitialAd() &nbsp;&nbsp; &nbsp;ads.load("interstital", { appId = intersititalAppID, testMode = true }) end local function showInterstitialAd() &nbsp;&nbsp; &nbsp;ads.show() end local function showInterstitial() &nbsp;&nbsp; &nbsp;print("checking to see if the interstital is ready") &nbsp;&nbsp; &nbsp;if ads.isLoaded("interstitial") then &nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;print("showing the interstitial") &nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;ads.show("interstitial", { appId = interstitialAppID, testMode = true }) &nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;timer.cancel(showAdTimer) &nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;showAdTimer = nil &nbsp;&nbsp; &nbsp;end end local function changeAds() &nbsp;&nbsp; &nbsp;print("changing ad types") &nbsp;&nbsp;&nbsp; ads.hide() &nbsp;&nbsp;&nbsp; -- &nbsp;&nbsp;&nbsp; -- use the ads.show() to test just showing an interstitial &nbsp;&nbsp;&nbsp; -- use the ads.load() to test using ad.load() &nbsp;&nbsp;&nbsp; -- &nbsp;&nbsp;&nbsp; --ads.show("interstitial", { appId = interstitialAppID, testMode = true } ) &nbsp;&nbsp;&nbsp; ads.load("interstitial", { appId = interstitialAppID, testMode = true } ) &nbsp;&nbsp;&nbsp; showAdTimer = timer.performWithDelay(100, showInterstitial,0) end -------------------------------------------------------------------------------- -- UI -------------------------------------------------------------------------------- -- initial variables local sysModel = system.getInfo("model") local sysEnv = system.getInfo("environment") -- Shows a specific type of ad showAd = function( adType, vendorAppID ) &nbsp;&nbsp; &nbsp;local adX, adY = 0, display.contentHeight + 10000 &nbsp;&nbsp; &nbsp;statusText.text = "Showing " .. adType &nbsp;&nbsp; &nbsp;ads.show( adType, { x=adX, y=adY, appId=vendorAppID, testMode = true } ) end -- if on simulator, let user know they must build for device if sysEnv == "simulator" then &nbsp;&nbsp; &nbsp;local font, size = native.systemFontBold, 22 &nbsp;&nbsp; &nbsp;local warningText = display.newRetinaText( "Please build for device or Xcode simulator to test this sample.", 0, 0, 290, 300, font, size ) &nbsp;&nbsp; &nbsp;warningText:setTextColor( 1 ) &nbsp;&nbsp; &nbsp;warningText.x, warningText.y = display.contentWidth \* 0.5, display.contentHeight \* 0.5 else &nbsp;&nbsp; &nbsp;-- start with banner ad &nbsp;&nbsp; &nbsp;showAd( "banner", appID ) &nbsp;&nbsp;&nbsp; timer.performWithDelay(15000, changeAds, 1) end local function onSystemEvent( event ) &nbsp;&nbsp;&nbsp; print( "System event name and type: " .. event.name, event.type ) &nbsp;&nbsp;&nbsp; if event.type == "applicationResume" and isInterstitialShowing then &nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;print("The ad closed") &nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;showBannerAd() &nbsp;&nbsp;&nbsp; end end Runtime:addEventListener( "system", onSystemEvent )

Just built and tested on my iPhone 6 yesterday morning.

This is all I see in the sim:

00000148.png

I see the same on device, too.