using ADMOB problem

i use this code to integrate admob ads


local ads = require( “ads” )

local platformName = system.getInfo( “platformName” )

local AdsBanners="ca-app-pub-xxxx "

local AdsInterstitials=“ca-app-pub-xxxx”

if  platformName == “Android”  then

    print(“android”)

    AdsBanners=“ca-app-pub-xxxx”

    AdsInterstitials=“ca-app-pub-xxxx”

end

function adListener( event )

 local msg = event.response

      if ( event.isError ) then

        print( “Error, no ad received”, msg )

      else

        ads.show( “interstitial”, { x=0, y=0, appId=AdsInterstitials } )  

      end  

end

ads.init(“admob”, AdsBanners, adListener)

ads.load( “interstitial”, { appId=AdsInterstitials, testMode=false } )

ads.show( “banner”, { x=0, y=100000, appId=AdsBanners } )


the problem is interstitial ads shows many times and i just call show one time

I see two potential problems.

First you tell it to load an interstitial but show a banner.  Even if this works, when ads.load() completes your listener will be triggered. When ads.show() completes your listener will be triggered.

In your listener, if you don’t have an error you request to show an interstitial. This will have been called twice asking for two interstitial. When those load, your listener triggers again and you get a new ad, when it completes listener is called and you call show ad again. In other words you basically have an infinite loop.

Rob

hi,

thank for your help

banner not show , interstitial  only show in loop

i use code as founded on coronalabs admob help ,and you say that this well make interstitial  loop ,so can you please help me to solve this with code

Google will likely not let you show a banner at the same time you’re showing an interstitial.

I see two potential problems.

First you tell it to load an interstitial but show a banner.  Even if this works, when ads.load() completes your listener will be triggered. When ads.show() completes your listener will be triggered.

In your listener, if you don’t have an error you request to show an interstitial. This will have been called twice asking for two interstitial. When those load, your listener triggers again and you get a new ad, when it completes listener is called and you call show ad again. In other words you basically have an infinite loop.

Rob

hi,

thank for your help

banner not show , interstitial  only show in loop

i use code as founded on coronalabs admob help ,and you say that this well make interstitial  loop ,so can you please help me to solve this with code

Google will likely not let you show a banner at the same time you’re showing an interstitial.