Hello everyone. I hope this message will be answered by someone. I will be grateful to anyone who can help.
I’m trying to implement Inmobi ads on my app but it does not works.
I create a module called “inmobi.lua” with the code below:
[blockcode]
module(…, package.seeall)
require “ads”
local isDevice = system.getInfo(“environment”) == “device”
local adNetwork = “inmobi”
local appID = “4028cba631d63df101320c65b7e803d3”
local adsTable = {
“banner320x48”,
“banner300x250”,
“banner728x90”,
“banner468x60”,
“banner120x600”
}
local resTable = {
{x=320, y=48},
{x=300, y=250},
{x=728, y=90},
{x=468, y=60},
{x=120, y=600},
}
local dummyAd
local dummyTimer
local adVisible = false
function init()
if isDevice then
ads.init( “inmobi”, “4028cba631d63df101320c65b7e803d3” )
end
end
local function stayOnTop()
dummyAd:toFront()
end
function showAd(adIndex, x, y)
if adVisible then return end
if isDevice then
ads.show(“banner320x48”, {x=0, y=0, interval=60, testMode=true})
else
dummyAd = display.newRect(0, 0, 320, 48)
dummyTimer = timer.performWithDelay(1000, stayOnTop, 0)
end
adVisible = true
end
function hideAd()
if isDevice then
ads.hide()
else
if dummyTimer then
timer.cancel(dummyTimer)
dummyTimer = nil
end
if dummyAd then
dummyAd:removeSelf()
dummyAd = nil
end
end
adVisible = false
end
– And then I put this on my main.lua:
_W = display.contentWidth
_H = display.contentHeight
display.setStatusBar( display.HiddenStatusBar )
local director = require(“director”)
local mainGroup = display.newGroup()
local function main()
mainGroup:insert(director.directorView)
director:changeScene(“menu”)
return true
end
require “inmobi”
inmobi.init()
inmobi.showAd(1, 0, 0)
inmobi.hideAd()
main() [import]uid: 81363 topic_id: 16007 reply_id: 316007[/import]