Hi
Update
A friend of mine tried playing the game, and he said that the ads showed after a minute or so… Strange?
I’ve searched around quite a bit but cannot find any solutions to my problem. Searching around helped me make the actual app, but now I have to ask for someones help I trying to implement admob to my app.
If i show the ad like this:
ads.show( "banner", { x=contentCenterX, y=0, appId=bannerAppId, testMode = true } )
I get an black ad-bacground (but no ad). If I remove the “testmode = true” part I don’t even get the blak ad-less background.
My build.settings are like this, including it all since I might overlook something.
settings = { orientation = { default = "landscapeRight", supported = { "landscapeRight", } }, plugins = { ["plugin.google.play.services"] = { publisherId = "com.coronalabs" }, }, iphone = { plist = { UIStatusBarHidden = false, UIPrerenderedIcon = true, -- set to false for "shine" overlay --UIApplicationExitsOnSuspend = true, -- uncomment to quit app on suspend --[[-- iOS app URL schemes: CFBundleURLTypes = { { CFBundleURLSchemes = { "fbXXXXXXXXXXXXXX", -- example scheme for facebook "coronasdkapp", -- example second scheme } } } --]] } }, -- Android permissions android = { usesPermissions = { "android.permission.INTERNET", "android.permission.ACCESS\_NETWORK\_STATE", }, } }
And in my game.lua file:
ads = require( "ads" ) appId = "ca-app-pub-numbers (changed them here)" if ( system.getInfo( "platformName" ) == "Android" ) then appId = "ca-app-pub-numbers (changed them here)" end adProvider = "admob" function adListener( event ) 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( adProvider, appId, adListener )
The code above is placed before the:
"function scene:create( event )
local sceneGroup = self.view" code.
And after:
ads.show( "banner", { x=contentCenterX, y=0, appId=bannerAppId, testMode = true } )
I haven’t linked to the app yet in admobs website, because I can’t find the app in Google Play store yet from admob. (I find it on play.google.com)
Do it need to be linked for ads to work? If so, searching the web didn’t tell me at all, and it would be a crucial information.
Any help is appreciated very much