Corona AdMobs integration issue.

-- CODE IN MY build.settings settings = { orientation = { default = "landscapeRight", supported = { "landscapeLeft", "landscapeRight" }, }, android = { versionCode = "11" }, androidPermissions = { "android.permission.INTERNET", "android.permission.WRITE\_EXTERNAL\_STORAGE", "android.permission.ACCESS\_NETWORK\_STATE", "android.permission.READ\_PHONE\_STATE", }, build = { neverStripDebugInfo = true }, plugins = { -- key is the name passed to Lua's 'require()' ["CoronaProvider.ads.admob"] = { -- required publisherId = "com.coronalabs", }, }, } -- CODE IN MY main.lua provider = "admob" appID = "ca-app-pub-XXX/XXX" AD\_TYPE = "interstitial" -- CODE IN MY HomeScreen.lua local adsObject = require ("ads") local toast = require ("toast") local function adListener( event ) local msg = event.response toast.new("Event Msg: "..msg, 2000) print("Message received from the ads library: ", msg) local statusText = display.newText( "", 0, 0, native.systemFontBold, 22 ) statusText:setTextColor(153, 0, 51) statusText.x, statusText.y = display.contentWidth \* 0.5, 160 if event.isError then IS\_ADD\_INIT = false toast.new("--FALSE--", 2000) statusText.text = "Error: "..msg; else toast.new("--TRUE--", 2000) IS\_ADD\_INIT = true statusText.text = "Success: "..msg; adsObject.show( AD\_TYPE , { x=centerX, y=centerY } ) end end function scene:enterScene( event ) local group=self.view if appID then adsObject.init( provider, appID, adListener ) else toast.new("NO APP ID", 2000) end end

PLEASE HELP.

I AM NOT ABLE TO LOAD ADS WITH THE ABOVE CODE.

 

my adListener(event) never gets called.

Please correct me!

The ads.init() does not call the listener, it just sets it up.  You need to move your ads.show() call into your enterScene() function after you call init.

Rob

The ads.init() does not call the listener, it just sets it up.  You need to move your ads.show() call into your enterScene() function after you call init.

Rob