Reputation: 19
my build.settings
settings =
{
orientation =
{
default = "portrait",
},
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 =
{
["CoronaProvider.ads.admob"] =
{
publisherId = "com.coronalabs",
supportedPlatforms = { ["android"] = true }
}
}
}
My main.lua
local background = display.newImage("backgroundrain.png")
background.x = display.contentWidth / 2
background.y = display.contentHeight / 2
local provider = "admob"
local appID = ""
local ads = require "ads"
--button
local widget = require( "widget" )
provider = "admob"
appID = ""
AD_TYPE = "banner"
local ads = require( "ads" )
local button1 = widget.newButton
{
defaultFile = "finallpicture.png",
overFile = "finallpicture2.png",
label = "",
emboss = true,
onPress = "finallpicture2.png",
onRelease = "finallpicture2.png",
}
button1.x = 495; button1.y = 950
local theaudio = audio.loadStream("theaudio.mp3")
function button1:touch(e)
if(e.phase == "ended") then
audio.play(theaudio)
end
end
button1:addEventListener("touch", button1)
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
statusText:setTextColor( 255, 0, 0 )
statusText.text = "Error Loading Ad"
statusText.x = display.contentWidth * 0.5
showAd( "banner" )
else
statusText:setTextColor( 0, 255, 0 )
statusText.text = "Successfully Loaded Ad"
statusText.x = display.contentWidth * 0.5
end
end
-- Initialize the 'ads' library with the provider you wish to use.
if appID then
ads.init( provider, appID, adListener )
end
When I run my code i get a pop up window that says "Plugin Download Error" The followign plugin could not be downloaded: com.coronalabs/CoronaProvider.ads.admob.
I know i am most likely missing something big here bit i have been trying to debug for days. I read the forum on corona about Corona Admobs Integration but I still cant get it.
I would love some suggestions if you have any.
Upvotes: 0
Views: 207
Reputation: 805
If you take a look at the docs. Your build.settings for the plugin of adMob is wrong, according to the docs replace:
plugins =
{
["CoronaProvider.ads.admob"] =
{
publisherId = "com.coronalabs",
supportedPlatforms = { ["android"] = true }
}
}
with
plugins =
{
["plugin.google.play.services"] =
{
publisherId = "com.coronalabs",
supportedPlatforms = { iphone=false, android=true }
},
},
}
Upvotes: 1