Hi,
I want to show admob ads only in end.lua file.And for that I have written this code.Its working but in the simulator output its showing a warning message like this,
18:46:07.622 WARNING: CoronaProvider.ads.admob is not configured in build.settings
18:46:07.622 WARNING: The ‘ads’ provider (admob) is not available on the simulator
18:46:07.622 WARNING: The ‘ads’ library is not available on this platform.
Here’s the build file. I think I have done everything in this and the simulator is also successfully running the game as well as it has built apk.file …but the there’s that WARNING making me uncomfortable. Also when I tried to test my game on online testing service it showed error.(The respective Image of this testing session is attached.Second Image ; ghg.JPG, is of testing session.)
-- -- For more information on build.settings see the Corona SDK Build Guide at: -- https://docs.coronalabs.com/guide/distribution/buildSettings -- settings = { orientation = { -- Supported values for orientation: -- portrait, portraitUpsideDown, landscapeLeft, landscapeRight default = "portrait", supported = { "portrait" }, }, plugins = { ["plugin.google.play.services"] = { publisherId = "com.coronalabs", supportedPlatforms = { android=true } }, }, excludeFiles = { -- Include only the necessary icon files on each platform iphone = { "Icon-\*dpi.png", }, android = { "Icon.png", "Icon-Small-\*.png", "Icon\*@2x.png", }, }, -- -- iOS Section -- iphone = { plist = { UIStatusBarHidden = false, UIPrerenderedIcon = true, -- set to false for "shine" overlay --UIApplicationExitsOnSuspend = true, -- uncomment to quit app on suspend CFBundleIconFiles = { "Icon.png", "Icon@2x.png", "Icon-167.png", "Icon-60.png", "Icon-60@2x.png", "Icon-60@3x.png", "Icon-72.png", "Icon-72@2x.png", "Icon-76.png", "Icon-76@2x.png", "Icon-Small.png", "Icon-Small@2x.png", "Icon-Small@3x.png", "Icon-Small-40.png", "Icon-Small-40@2x.png", "Icon-Small-50.png", "Icon-Small-50@2x.png", }, }, }, -- -- Android Section -- android = { usesPermissions = { "android.permission.INTERNET", }, }, }
Here’s the end.lua file. Also in ads.show and ads.load have I write interstitial instead of Zypa.(Zypa is the name of ZypaInt1 ad unit)
ads.show( “ZypaInt1”, { x=0, y=0, appId=“ca-app-pub-2797129717270770~4742748044” } )
ads.load( “ZypaInt1”, { appId=“ca-app-pub-2797129717270770~4742748044”, testMode=false } )
-- ----------------------------------------------------------------------------------------- local composer = require( "composer" ) local scene = composer.newScene() local widget = require "widget" local playButton -------------------------------------------- local ads = require( "ads" ) local function adListener( event ) if ( event.isError ) then -- Failed to receive an ad else ads.show( "ZypaInt1", { x=0, y=0, appId="ca-app-pub-2797129717270770~4742748044" } ) end end ads.init( "admob", "ca-app-pub-2797129717270770~4742748044", adListener ) ads.load( "ZypaInt1", { appId="ca-app-pub-2797129717270770~4742748044", testMode=false } ) local function destroyScene() composer.gotoScene( "Zgame", { time=800, effect="crossFade" } ) composer.removeScene("end") end function scene:create( event ) local sceneGroup = self.view -- Code here runs when the scene is first created but has not yet appeared on screen local background = display.newImageRect( scene.view, "relaunch.png",display.actualContentWidth, display.actualContentHeight ) background.x = display.contentCenterX background.y = display.contentCenterY local laserSound = audio.loadSound( "end.mp3" ) local laserChannel = audio.play( laserSound ) local function playButton () playButton = display.newText( scene.view, "Play", display.contentCenterX, display.contentCenterY+180, native.systemFont, 44 ) playButton:setFillColor( 0.8, 2.2, 1.3 ) playButton:addEventListener( "tap", function() composer.gotoScene( "Zgame", { time=800, effect="crossFade" } ) end ) playButton:addEventListener( "tap", function () destroyScene() end ) end local myclosure = function () return playButton () end timer.performWithDelay( 7000, myclosure, 1) end function scene:show( event ) local sceneGroup = self.view local phase = event.phase if phase == "will" then elseif phase == "did" then local secondsLeft = 0 local clockText = display.newText(secondsLeft, display.contentCenterX , 410, native.systemFontBold, 100) clockText:setFillColor( 0.2, 0.5, 0.5 ) local function updateTime( event ) secondsLeft = secondsLeft - 1 local seconds = secondsLeft % 5 local timeDisplay = string.format( "%02d", seconds ) clockText.text = timeDisplay end transition.blink( clockText, { time=2000 } ) textremoval = timer.performWithDelay( 5000, function() display.remove(clockText) end, 1) time = timer.performWithDelay( 1000, updateTime, secondsLeft ) -- Called when the scene is now on screen -- -- INSERT code here to make the scene come alive -- e.g. start timers, begin animation, play audio, etc. end end function scene:hide( event ) local sceneGroup = self.view local phase = event.phase if event.phase == "will" then -- Called when the scene is on screen and is about to move off screen -- -- INSERT code here to pause the scene -- e.g. stop timers, stop animation, unload sounds, etc.) elseif phase == "did" then -- Called when the scene is now off screen end end function scene:destroy( event ) local sceneGroup = self.view -- Called prior to the removal of scene's "view" (sceneGroup) -- -- INSERT code here to cleanup the scene -- e.g. remove display objects, remove touch listeners, save state, etc. if playButton then display.remove( playButton ) playButton:removeSelf() -- widgets must be manually removed playButton = nil end end --------------------------------------------------------------------------------- -- Listener setup scene:addEventListener( "create", scene ) scene:addEventListener( "show", scene ) scene:addEventListener( "hide", scene ) scene:addEventListener( "destroy", scene ) ----------------------------------------------------------------------------------------- return scene