You can try this code out…
This goes in a main.lua…
local unusedWidth = display.actualContentWidth - display.contentWidth local unusedHeight = display.actualContentHeight - display.contentHeight local left = 0 - unusedWidth/2 local top = 0 - unusedHeight/2 local right = display.contentWidth + unusedWidth/2 local bottom = display.contentHeight + unusedHeight/2 local bannerID = "ca-app-pub-xxx --put your id here.." local testMode = true local ads=require("ads") local function adListener( event ) for k,v in pairs( event ) do print("adListener ", k, v ) -- so you see everything you get end end ads.init("admob", bannerID, adListener ) ads:setCurrentProvider("admob") ads.load("admob", { appId = bannerID, testMode = testMode } ) local function showAd( adPosition, isTestMode ) local xPos, yPos local adPosition = "bottom" if adPosition == "top" then xPos = display.screenOriginX yPos = top elseif adPosition == "bottom" then xPos = display.screenOriginX yPos = bottom end ads:setCurrentProvider("admob") ads.show( "banner", { x = xPos,y = yPos, appId = bannerID, testMode = isTestMode } ) end showAd( "top", testMode )
And heres the build.settings
settings = { plugins = { ["plugin.google.play.services"] = { publisherId = "com.coronalabs" }, }, android = { usesPermissions = { "android.permission.INTERNET", "android.permission.ACCESS\_NETWORK\_STATE", }, }, }
And heres config
application = { content = { width = 320, height = 480, scale = "letterbox", -- Best fps = 30, }, }
Good Luck!
– I DO NOT TAKE ANY CREDIT FOR THE CODE ITS ALL FROM @Roaminggamer –