Problem with adMob and storyboard (and composer ?)

Hello, i would like to know if i can show a banner, hide it and show it again between some scenes.

To be more precise, i need to show a banner in the menu and level selection, hide it in the game, show an interstitial ad after x lose in game over function and if the player go back to the menu show a banner again.

Now, i can only show the banner in the menu and level selection and i can hide it, i can’t show the interstitial ad but that’s the same problem with the banner.

it work one time : 

require ads=("ads") some code ads.show( "banner", { x=0, y=0,appId=bannerID,testmode=true } ) function scene:createScene( event ) some code end

and the problem :

require ads=("ads") some code function scene:createScene( event ) some code ads.show( "banner", { x=0, y=0,appId=bannerID,testmode=true } ) end

when i try like that, everything work but it display nothing. when i try adding it in the view, it display nothing and i have a bug "error table expected … have used a ‘.’ instead of a ‘:’ "

mmmmh i will try to see with composer if it work or not.

thanks for reading my problem and trying to find how to resolve it. ^^"

Hello @ericlozanovski,

Your syntax on the require should be something like:

[lua]

local ads = require( “ads” )

[/lua]

By the way, which ad provider(s) are you planning to use?

Brent

oh here is the code i used when it work one time (the one before was something i write fast to show an example) and for now, i’m trying to make only admob work ^^":

local ads = require( "ads" ) local bannerID = ""--\> i left it blank only to show it on the forum local provider = "admob" local function adListener( event ) -- event table includes: -- event.provider -- event.isError (e.g. true/false ) local msg = event.response -- just a quick debug message to check what response we got from the library print("Message received from the ads library: ", msg) if event.isError then print( "Error, no ad received", msg ) else print( "Ah ha! Got one!" ) end end ads.init( provider, appID, adListener ) ads.show( "banner", { x=0, y=0,appId=bannerID,testmode=true } )

Hello @ericlozanovski,

Your syntax on the require should be something like:

[lua]

local ads = require( “ads” )

[/lua]

By the way, which ad provider(s) are you planning to use?

Brent

oh here is the code i used when it work one time (the one before was something i write fast to show an example) and for now, i’m trying to make only admob work ^^":

local ads = require( "ads" ) local bannerID = ""--\> i left it blank only to show it on the forum local provider = "admob" local function adListener( event ) -- event table includes: -- event.provider -- event.isError (e.g. true/false ) local msg = event.response -- just a quick debug message to check what response we got from the library print("Message received from the ads library: ", msg) if event.isError then print( "Error, no ad received", msg ) else print( "Ah ha! Got one!" ) end end ads.init( provider, appID, adListener ) ads.show( "banner", { x=0, y=0,appId=bannerID,testmode=true } )