Tried implementing Corona Ads for my game, and used examples from many sources. Tried to see if it worked in the simulator, and it did not. So I built it for windows, and still got errors at the restart screen (where the ad would pop up).
Build Settings:
-- -- For Ads -- plugins = { ["plugin.coronaAds"] = { publisherId = "com.coronalabs", supportedPlatforms = { iphone=true, android=true } }, ["plugin.google.play.services"] = { publisherId = "com.coronalabs", supportedPlatforms = { android=true } }, ["shared.android.support.v4"] = { publisherId = "com.coronalabs", supportedPlatforms = { android=true } }, },
Error in Simulator:
16:54:11.314 WARNING: The 'plugin.coronaads' library is not available on this platform. 16:54:11.314 WARNING: The 'plugin.coronaads' library is not available on this platform.
Error on Windows exe
Code Implementation:
-
Requires
local composer = require( “composer” ) local myData = require( “myData” ) local score = require( “score” ) local coronaAds = require( “plugin.coronaAds” ) local scene = composer.newScene() _W = display.contentWidth; _H = display.contentHeight local bannerPlacement = “top-banner-320x50” local interstitialPlacement = “interstitial-1” local randomAd = math.random(1,10)
-
Functions
local function showAd() if randomAd == 10 then coronaAds.hide() coronaAds.show(insterstitialPlacement, true) else coronaAds.hide() coronaAds.show(bannerPlacement, false) end end local function adListener(event) if (event.phase == “init”) then showAd() end end
-
In scene create
coronaAds.init(“d6da6e86-c97a-478d-8b67-8b0122b9c785”, adListener)
-
Scene Show, did phase
showAd()
-
Scene Hide, will phase
coronaAds.hide()
Any help or advice would be greatly appreciated. Also, on a side note, I’m unaware of how to get my own api key when I can’t create a new app on my corona ads dashboard without inputting app store information. Since I haven’t finished my app, I have not submitted my app and thus don’t have that kind of information.