Hi @tarun9, I’ve updated my library, here is the code:
if( not \_G.fx.ads ) then \_G.fx.ads = {height = 0, rateShown = false} end local fxAds = \_G.fx.ads
_G.w = display.contentWidth
_G.h = display.contentHeight
local ads = require(“ads”) local function fxAdListener(event) table.dump(event) end function fxAds.init() print(‘initializing ads’) – Load Corona ‘ads’ library local baseCalculation = w / 320 if system.orientation ~= “portrait” then baseCalculation = h / 320 end if fx.device.isApple then if fx.device.isTablet then fxAds.bannerWidth = w if system.orientation ~= “portrait” then fxAds.bannerHeight = baseCalculation * 30 else fxAds.bannerHeight = baseCalculation * 32 end else fxAds.bannerWidth = w if w > h then fxAds.bannerHeight = baseCalculation * 32 else fxAds.bannerHeight = baseCalculation * 50 end end – The name of the ad provider. local adNetwork = “iads” local appID = appInfo.ads.iAds ads.init(adNetwork, appID, fxAdListener) elseif fx.device.isAndroid then if fx.device.isTablet then fxAds.bannerWidth = w fxAds.bannerHeight = baseCalculation * 90 else fxAds.bannerWidth = w fxAds.bannerHeight = baseCalculation * 50 end --fxAds.bannerHeight = fxAds.bannerHeight / 2 – The name of the ad provider. local adNetwork = “admob” local appID = appInfo.ads.adMob ads.init(adNetwork, appID, fxAdListener) end end function fxAds.showBanner(x, y, params) if fx.device.isSimulator then if params.srpH == “bottom” then y = y - fxAds.bannerHeight end fxAds.adBox = display.newGroup() local o = display.newRect(fxAds.adBox, x+fxAds.bannerWidth/2, y+fxAds.bannerHeight/2, fxAds.bannerWidth, fxAds.bannerHeight) o:setFillColor(255, 0, 0) --o = fx.ui.newText(fxAds.adBox, “Ads Here”, 0, 0, native.systemFont, iif(fx.device.isTablet, 30, 25)) --o.x = x + fxAds.bannerWidth/2 --o.y = y + fxAds.bannerHeight/2 elseif fx.device.isApple then ads.show(“banner”, {x=x, y=y, testMode=appInfo.mode == “TESTING”}) elseif fx.device.isAndroid then ads.show(“banner”, {x=x, y=y, testMode=appInfo.mode == “TESTING”}) end end function fxAds.hide() ads.hide() end fxAds.init() — Example to show the ads on the Top fx.ads.showBanner(0, 0, {}) — Example to show the ads on the bottom fx.ads.showBanner(0, display.contentHeight, {srpH = “bottom”})
At last there are 2 example of how to place the ads on the top and the bottom of the screen. I’ve also created a github repository for my framework. You can download the code at: https://github.com/juancsdc/fx.sdk
The framework is still under development, but at least you can use the ads module.
Hope this can help you.