I have paid admob plugin and i am use this plugin in my 5-6 landscape game.
In landscape banner ad not load from admob server for all android devices. but in my portrait game is load fine every time and for every android devices.
Interstitial is okay for all devices.
Any one can help me ?
My Admob Code:
------ adUnit.lua --------
adUnit = {}
admob = require( “plugin.admob” )
textMode = display.newText( “No AD”, display.contentWidth/2, 80, native.systemFont , 25 )
textMode:setFillColor( 0 )
textMode.isVisible = false
if (sysEnv == “Android”) then
admob_appId = setting.admob_id.android.app_id
adUnit.bannerAdId = setting.admob_id.android.adunit_id_banner
adUnit.interstitialAdId = setting.admob_id.android.adunit_id_interstitial
--adUnit.videoAdId = “ca-app-pub-1106092504256274/5796366149”
elseif (sysEnv == “iPhone OS”) then
admob_appId = setting.admob_id.ios.app_id
adUnit.bannerAdId = setting.admob_id.ios.adunit_id_banner
adUnit.interstitialAdId = setting.admob_id.ios.adunit_id_interstitial
– adUnit.videoAdId = “ca-app-pub-1106092504256274/5656765341”
end
local bannerHeight = 50
adUnit.adShown = false
adUnit.adListener = function(event)
local msg = event.response
– Quick debug message regarding the response from the library
print( "Message from the ads library: ", msg )
if ( event.phase == “init” ) then
adUnit.adLoad(“banner”)
adUnit.adLoad(“interstitial”)
elseif ( event.phase == “loaded” ) then
– an ad was preloaded
if (event.type == “banner”) then
bannerHeight = admob.height()
adUnit.adShow(“banner”)
end
elseif ( event.phase == “closed” ) then
if (event.type == “interstitial”) then
adUnit.adShow(“banner”)
adUnit.adLoad(“interstitial”)
end
elseif (event.phase == “failed”) then
if (event.type == “banner”) then
– textMode.text = “banner”
– -- textMode.text = event.data
– local response = json.decode(event.data)
– loadSave.saveTable(response , “temp1.json”)
– local data = loadSave.loadTable(“temp1.json”)
– if (data == nil) then
– textMode.text = “Nil Value”
– else
– for k,v in pairs(data) do
– textMode.text = textMode.text…"\n"…k…"\n"…v…"\n"
– end
– textMode.x = _W/2
– textMode.y = _H/2
– end
end
end
end
adUnit.adInit = function()
admob.init( adUnit.adListener , { appId = admob_appId , testMode = true } )
end
adUnit.adShow = function( name )
if (name == “banner”) then
if (admob.isLoaded( “banner” )) then
adUnit.adShown = true
admob.show( “banner”, {y = display.actualContentHeight - bannerHeight } )
else
adUnit.adLoad(“banner”)
end
elseif (name == “interstitial”) then
if (admob.isLoaded( “interstitial” )) then
admob.show( “interstitial” )
else
if (adUnit.adShown == false) then
adUnit.adShow(“banner”)
end
adUnit.adLoad(“interstitial”)
end
end
end
adUnit.adLoad = function( name )
if (name == “interstitial”) then
if (admob.isLoaded( “interstitial” )) then
—
else
admob.load( “interstitial”, { adUnitId = adUnit.interstitialAdId } )
end
elseif (name == “rewardedVideo”) then
if (admob.isLoaded( “rewardedVideo” )) then
—
else
admob.load( “rewardedVideo”, { adUnitId = adUnit.rewardedVideoAd } )
end
elseif (name == “banner”) then
if (admob.isLoaded( “banner” )) then
—
else
admob.load( “banner”, { adUnitId = adUnit.bannerAdId } )
end
end
end
adUnit.adHide = function()
if (adUnit.adShown) then
adUnit.adShown = false
admob.hide()
end
end
return
--------build.settings-------
–
– 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 = “landscapeRight”,
supported = { “landscapeRight”, },
},
plugins =
{
[“CoronaProvider.native.popup.social”] =
{
publisherId = “com.coronalabs”
},
[“plugin.google.iap.v3”] =
{
publisherId = “com.coronalabs”,
supportedPlatforms = { android=true }
},
[“plugin.admob”] =
{
publisherId = “com.coronalabs”
},
[“CoronaProvider.gameNetwork.apple”] =
{
publisherId = “com.coronalabs”,
supportedPlatforms = { iphone=true}
},
[“plugin.gpgs”] =
{
publisherId = “com.coronalabs”,
supportedPlatforms = { android=true }
},
},
–
– iOS Section
–
iphone =
{
plist =
{
UIStatusBarHidden = false,
UIPrerenderedIcon = true, – set to false for “shine” overlay
--UIApplicationExitsOnSuspend = true, – uncomment to quit app on suspend
MinimumOSVersion = “7.0”,
CFBundleIconFiles =
{
“Icon-40.png”,
“Icon-58.png”,
“Icon-76.png”,
“Icon-80.png”,
“Icon-87.png”,
“Icon-120.png”,
“Icon-152.png”,
“Icon-167.png”,
“Icon-180.png”,
},
},
},
–
– Android Section
–
android =
{
googlePlayGamesAppId = “735398620501”,
usesPermissions =
{
“com.android.vending.BILLING”,
“com.android.vending.CHECK_LICENSE”
},
},
}