Thanks Alex, that’s helpful. I’ll give it a try and let you know if I run into any issues.
- Andrew [import]uid: 109711 topic_id: 34226 reply_id: 144886[/import]
Thanks Alex, that’s helpful. I’ll give it a try and let you know if I run into any issues.
That sounds great, Alex. Thank you for the info.
It sounds like what I need to do is to call ads.init of all ad providers I want in main.lua, and then call ads:setCurrentProvider in the module I want to show ads. My plan is to toggle among different ad providers – not just when one provider fails to deliver.
And if I haven’t misunderstood the way it works, I can show iAds banner on one screen and another ad provider’s full screen interstitial ad on another screen. This is important for me especially since iAds does not offer full screen interstitial ads for iPhone/iPod.
Thanks again.
Naomi
Edit: Actually, I will call ads.init of all ad providers in the module I want to show ads but I’ll include a flag to indicate whether or not the ads are already initialized. If it’s already initialized, I’d skip initializing the next time the user hit the screen. I think it would help avoid the ads-already-initialized warning. [import]uid: 67217 topic_id: 34226 reply_id: 144892[/import]
Hi,
I found another problem. When I try to display an a banner ad on the very bottom of the screen, for some reason it shows up a couple of pixels higher than it should.
Here is the code I am using:
[lua]
function _G.showAd(pos)
if pos == “bottom” then
local adY = display.contentHeight - display.screenOriginY - 66
if system.getInfo(“model”) ~= “iPad” then
adY = display.contentHeight - display.screenOriginY - 50
end
ads.show( “banner”, { x=originx, y=adY } )
end
end
showAd(“bottom”)
[/lua]
Does anyone know why this happens?
UPDATE: I changed the adY to display.contentHeight - display.screenOriginY and now Its showing up at the very bottom. Can someone explain why this happens? [import]uid: 130035 topic_id: 34226 reply_id: 143246[/import]
@haakon, i’ll have a solution very soon for both the rotation bugs and the whitespace one you reported.
@Kyle Coburn: thanks for reporting, i’ll have an update on that very soon as well.
@deleurapps: is the code in the post the updated version? Because i see nothing wrong in it…
Alex. [import]uid: 196533 topic_id: 34226 reply_id: 143341[/import]
@alex, thats great! But…
what exactly does “very soon” mean? I’m asking because we have just submitted the new version to Apple, and I’m concidering re-submitting with iAds working properly. We have a deadline with the publisher and a huge campaign starting March 3, so we can only wait one, max two days for the fix to find it’s way into a daily. Is that going to happen? [import]uid: 21746 topic_id: 34226 reply_id: 143351[/import]
Hi Alex, I integrated both iAds and inneractive, using the method you described in post #63 above. The problem is, when I set the ads:setCurrentProvider to “inneractive”, I don’t get any adListener response. The inneractive fullscreen ads do appear, but my app doesn’t know that it has appeared, and it ends up hanging my app after I close the inneractive fullscreen ad. Is this a bug? Or am I doing something wrong? Please see below the relevant code that I extracted from mine and let me know your thoughts.
Naomi
Edit: incomplete code updated
[code]
– in main.lua
_G.initAds = false
– in menu.lua
local showAds = require( “showAds” )
if _G.initAds == false then showAds.startAds() end
– in showAds.lua
local M = {}
local adListener
local adType, adParam
local adX, adY, adInterval, adTest
function M.startAds()
_G.initAds = true;
local appID = “com.mycompany.myapp”
ads.init( “iads”, appID, adListener )
if (string.sub( myDevice.model,1,4) == “iPad”) then
appID = “mycompany_myapp_iPad”
ads.init( “inneractive”, appID, adListener )
else
appID = “mycompany_myapp_iPhone”
ads.init( “inneractive”, appID, adListener )
end
end
function adListener(event)
print("--------------- inside adListener ----------------")
– event table includes:
– event.provider (e.g. “inneractive” or “iads”)
– event.isError (e.g. true/false )
print("event.response = " … tostring(event.response))
print("event.provider = " … tostring(event.provider))
print("event.isError = " … tostring(event.isError))
print("adType = " … tostring(adType))
print("adNetwork = " … tostring(adNetwork))
if adType == “full” then
if event.isError then
ads.hide()
– show house ads here
else
– fullscreen interstitial ad is being displayed
– behind the screen, update my app to advance to the next screen
timer.performWithDelay( 2000, M.goNext )
end
else
– banner ads
end
end
function M.show(doNext)
M.goNext = doNext
adType = “full”
adNetwork = “inneractive”
adX=0; adY=0; adInterval=180; adTest=false;
adParam = “fullscreen”
ads:setCurrentProvider(adNetwork)
if adNetwork == “inneractive” then
ads.show( adParam, { x=adX, y=adY, interval=adInterval, testMode=adTest } )
end
end
– in a scene module where I want to show ads
local function nextScreen()
– here I have routine that advances the screen to the next screen that
– I want to show after the ads are closed
end
showAds.show( nextScreen )
[/code] [import]uid: 67217 topic_id: 34226 reply_id: 144991[/import]
Hi Naomi,
Hard to say what is causing the freezing. The listener part not getting events is for sure something in your code. I just tried this:
local ads = require( "ads" )
local function adListener(event)
print("event.response = " .. tostring(event.response))
print("event.provider = " .. tostring(event.provider))
print("event.isError = " .. tostring(event.isError))
end
ads.init( "iads", "com.test.test", adListener )
ads.init( "inneractive", "com.test.test", adListener )
ads:setCurrentProvider("inneractive")
ads.show( "banner", { x=0, y=0, interval=60 } )
local function switchAds()
ads.hide()
ads:setCurrentProvider("iads")
ads.show( "banner", { x=0, y=0 } )
end
timer.performWithDelay( 5000, switchAds )
as a small testbed, and it works perfectly.
As for the freezing part, i just moved from a screen to another while displaying a fullscreen inneractive ad, and that works. I am thinking maybe deallocating some variables that you should not. I would need to know exactly what you’re doing (like i change from main to level1 while maintaining the adview on the screen) and what are you using (storyboard, director, custom code) at least to know where to start thinking at.
Alex. [import]uid: 196533 topic_id: 34226 reply_id: 144994[/import]
Thank you, Alex. I use storyboard, and I don’t change scene before or after the ad is shown. When the showAds.show is called, most of the display objects on the scene is made invisible, and what nextScreen function does is to make them all back to be visible.
Do you think it might be more effective if I create a test case project and file it as a bug?
Naomi [import]uid: 67217 topic_id: 34226 reply_id: 144996[/import]
Hi Naomi,
That would be amazing, and please paste back the bug number here so i can have a look.
Thanks a lot
What about the listener not receiving events? Did you sort that out?
Alex. [import]uid: 196533 topic_id: 34226 reply_id: 144998[/import]
Hi Alex, I just filed Case 21361.
The listener-not-receiving-events when “inneractive” is used as the adnetwork is the bug. I can use iads and revmob together without a problem, but when I use iads and inneractive together, the listener isn’t getting any response when it’s on iPod device.
Thanks for looking into this.
Naomi [import]uid: 67217 topic_id: 34226 reply_id: 144999[/import]
@alex, that is the old code.
the updated version would look something like this:
[lua]
function _G.showAd(pos)
if pos == “bottom” then
local adY = display.contentHeight - display.screenOriginY
ads.show( “banner”, { x=originx, y=adY } )
end
end
showAd(“bottom”)
[/lua]
So the y coordinate is the very bottom of the screen.
I have no idea why that works, but it shows correctly on both the xcode simulator, and any device. [import]uid: 130035 topic_id: 34226 reply_id: 143416[/import]
Hi Alex, I saw a post by heftyApps that mentions the same issue (but described differently) along with another crash issue here:
http://developer.coronalabs.com/forum/2013/03/06/inneractive-major-crash-issue-please-help
Naomi [import]uid: 67217 topic_id: 34226 reply_id: 145208[/import]
@alexf or someone else over at Coronium, what is the status here? Why do we need to wait so long for the rotation fix? [import]uid: 21746 topic_id: 34226 reply_id: 143044[/import]
Hi,
I found another problem. When I try to display an a banner ad on the very bottom of the screen, for some reason it shows up a couple of pixels higher than it should.
Here is the code I am using:
[lua]
function _G.showAd(pos)
if pos == “bottom” then
local adY = display.contentHeight - display.screenOriginY - 66
if system.getInfo(“model”) ~= “iPad” then
adY = display.contentHeight - display.screenOriginY - 50
end
ads.show( “banner”, { x=originx, y=adY } )
end
end
showAd(“bottom”)
[/lua]
Does anyone know why this happens?
UPDATE: I changed the adY to display.contentHeight - display.screenOriginY and now Its showing up at the very bottom. Can someone explain why this happens? [import]uid: 130035 topic_id: 34226 reply_id: 143246[/import]
@haakon, i’ll have a solution very soon for both the rotation bugs and the whitespace one you reported.
@Kyle Coburn: thanks for reporting, i’ll have an update on that very soon as well.
@deleurapps: is the code in the post the updated version? Because i see nothing wrong in it…
Alex. [import]uid: 196533 topic_id: 34226 reply_id: 143341[/import]
@alex, thats great! But…
what exactly does “very soon” mean? I’m asking because we have just submitted the new version to Apple, and I’m concidering re-submitting with iAds working properly. We have a deadline with the publisher and a huge campaign starting March 3, so we can only wait one, max two days for the fix to find it’s way into a daily. Is that going to happen? [import]uid: 21746 topic_id: 34226 reply_id: 143351[/import]
@alex, that is the old code.
the updated version would look something like this:
[lua]
function _G.showAd(pos)
if pos == “bottom” then
local adY = display.contentHeight - display.screenOriginY
ads.show( “banner”, { x=originx, y=adY } )
end
end
showAd(“bottom”)
[/lua]
So the y coordinate is the very bottom of the screen.
I have no idea why that works, but it shows correctly on both the xcode simulator, and any device. [import]uid: 130035 topic_id: 34226 reply_id: 143416[/import]
I’m wondering what the status might be with “multiple init and switch between ad.” It’s mentioned in the post #20 of this thread. If it’s not available, and if we want to switch between ad providers, do we call ads.init locally in a module every time we call ads.show? When we call ads.init with different ad providers, are we basically re-initializing the ads? I’m thinking of toggling between iAds, InMobi and inneractive. Has anyone tried this? Is it effective? Any oddity switching ad providers?
Also, I checked the daily build notes, but I haven’t located a mention of orientation bug fix. Is it yet to be fixed? (I’m using daily build 1041 now.)
Naomi [import]uid: 67217 topic_id: 34226 reply_id: 144839[/import]
Hi Naomi,
I experimented with this a bit and didn’t get it to work. If I remember right, after calling ads.init for one provider with one callback function, later calling another provider with another callback function, and then attempting to go back to the first provider, the log output noted that the first provider had already been initialized, and my requests went to the second provider. But I don’t think I tested it as carefully as I could have, so it may be possible after all.
On the second question, iAds do have the right orientation for me. Last I checked, inneractive didn’t, but that was before the recent fix for iAds, which maybe addressed the inneractive bug too.
[import]uid: 109711 topic_id: 34226 reply_id: 144840[/import]
Hi Andrew,
Thank you for your reply post. It’s a bit worrisome. I haven’t implemented the switch part, but if I call ads.init every time I want to show ads, the console gives me warning. It feels a bit messy to me. But then, from what I hear, switching between ad providers is quite effective in getting most out of ad revenue. I hope I can work this out somehow…
About the orientation issue, glad to hear it’s working for you. My latest app is horizontal so I wanted to make sure things will go smoothly.
Thanks again,
Naomi [import]uid: 67217 topic_id: 34226 reply_id: 144842[/import]