Ok, I'm having a bit of trouble. I've followed the "Ads (inneractive)multiple times and still can't get any ads to display when I build for the device (android). Especially "banner or "text (I get a white screen with "fullscreen").
I've tried dozens of combinations, and have followed the tutorial precisely and have looked at the Ansca Inneractive example. Am I missing something obvious?
I've been putting local ads = require "ads" in my Main.lua and the rest of the required code for displaying ads in other scenes.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 | module(..., package.seeall) function new() local localGroup = display.newGroup() --Images local background = display.newImage("menuBackground.png") background.xScale =.5 background.yScale = .5 background:setReferencePoint(display.TopLeftReferencePoint) localGroup:insert(background) local choseDiffBtn = display.newImage("present_big.png") choseDiffBtn.x = display.contentWidth*0.5 - 100 choseDiffBtn.y = display.contentHeight*0.5 choseDiffBtn.xScale = .37 choseDiffBtn.yScale = .37 localGroup:insert(choseDiffBtn) -- Example for inneractive: ads.init( "inneractive", "IA_GameTest" ) -- iPhone, iPod touch, iPad ads.show( "banner", { x=100, y=100, interval=10 } ) local goDifficulty = function ( event ) if event.phase == "began" then director:changeScene( "difficulty", "moveFromRight") end end choseDiffBtn:addEventListener( "touch" , goDifficulty) return localGroup end |
Hey there,
ads.init() should only be called once, so I'd suggest calling it in main.lua after require "ads".
I just tested on an Android device running 2.2, the banners showed fine after about 6 seconds from launch.
When testing this you have got internet access turned on, yes? (I only ask as I've forgotten mine was off previously.)
Peach :)
FORGET ABOUT IT!
Looks like you have not created the necessary AppID into Inneractive to get it working.
ads.init( "inneractive", "xxxAppIDxxx" <---)
http://developer.anscamobile.com/reference/ads-inneractive --> at the bottom of this link there is a small image showing you how to get your AppID for Inneractive.
Hope it help!
Cheers,
Rodrigo.
Thanks you peach pellen for the fast reply. I did as you suggested and placed the ads.init() in the main.lua, but I still have the same results.
Also I didn't place my app id in the code for security reasons. Sorry for not mentioning I did so:)
Does anything appear wrong with my main.lua?
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 | local priorNewText = display.newText display.newText = function( text, xPos, yPos, font, size ) local actualText = text or "" local actualFont = font or "Helvetica" local actualSize = size or 16 local xScale, yScale = display.contentScaleX, display.contentScaleY local sizeMultiply = 1 if xScale < 1.0 or yScale < 1.0 then sizeMultiply = 2 end local t = priorNewText( actualText, 0, 0, actualFont, actualSize * sizeMultiply ) t:setReferencePoint( display.TopLeftReferencePoint ) t.xScale, t.yScale = xScale, yScale t.x, t.y = xPos, yPos or 0, 0 return t end _w = display.contentWidth; _H = display.contentHeight; local director = require("director"); local ui = require("ui"); local ads = require "ads" -- Example for inneractive: ads.init( "inneractive", "DigitalArtAssets_SantasToyDrop_Android" ) local mainGroup = display.newGroup(); local function main() mainGroup:insert(director.directorView) director:changeScene("menu"); return true; end main() |