Okay so that actually doesn’t seem to work. I am using the latest Daily Build 1056 and testing on an iPad3.
iAds seems to work perfectly.
inneractive ads show up, but the adListener event is never called.
inMobi, nothing really happens. I see an inmobi ad request, but the adListener is never called and an ad never shows up.
And after a little while the app crashes.
This was a test, so all I had was a main.lua file with this:
[lua]
local ads = require( “ads” )
local function adListener(event)
print("--------------------AD RESPONSE")
print("event.response = " … tostring(event.response))
print("event.provider = " … tostring(event.provider))
print("event.isError = " … tostring(event.isError))
print("-------------------------------")
end
local adProv = {“iads”,“inneractive”,“inmobi”}
local adIndex = 1
ads.init( “iads”, “my iads id”, adListener )
ads.init( “inneractive”, “my inneractive id”, adListener )
ads.init( “inmobi”, “my inmobi id”, adListener )
ads:setCurrentProvider(“iads”)
ads.show( “banner”, { x=0, y=0, interval=60 } )
local function switchAds()
ads.hide()
adIndex = adIndex + 1
if adIndex > #adProv then
adIndex = 1
end
print(">> SWITCH TO "…tostring(adProv[adIndex]))
ads:setCurrentProvider(adProv[adIndex])
if adProv[adIndex] == “inmobi” then
ads.show( “banner320x48”, { x=0, y=100 } )
else
ads.show( “banner”, { x=0, y=100 } )
end
end
timer.performWithDelay( 15000, switchAds,0)
[/lua]