Ads Demo Code Help

Hello,

I’ve decided to try to implement inMobi in my next game.
My app is not yet in the app store but I registered it anyway with inMobi and received a code. I believe this code should allow be to pull ads in test mode. I then inserted this identifying code into the inMobi demo code that comes with Corona 2011.691 and insured that the test mode flag was set to true. After building for my device I loaded the demo code onto my iPhone 4… but when I run the demo I don’t see any banners. I do see two buttons labeled “Show Newt Banner” and “Hide Banner”… but no actual banners. Any tips are greatly appreciated.
Thanks!
Tim [import]uid: 16901 topic_id: 18289 reply_id: 318289[/import]

Sometimes it acts weird in test mode. Also, ads will not appear until InMobi approves your app. Even then unless you have a huge number of downloads your fill rate will not be %100. [import]uid: 10903 topic_id: 18289 reply_id: 70062[/import]

Thanks… I see in another thread the following:
local ads = require “ads”

Is this referring to an ads.lua file? I don’t have anything called ads.

Thanks again,
Tim [import]uid: 16901 topic_id: 18289 reply_id: 70068[/import]

That’s probably the issue. Ads is not a module that you make, saying require ads is a way of, let’s say, “opening” up the ads API. [import]uid: 10903 topic_id: 18289 reply_id: 70070[/import]

“ads” is a core module, which means you do not need an ads.lua file. But its not included by default since not everyone needs it and it does add size to your project.

[import]uid: 19626 topic_id: 18289 reply_id: 70093[/import]

here is the code I have been using in my apps. i know it works but as everyone is saying… with he test codes its hit or miss if you actually see them in your “test app” but i do know when i switch this over to my live app codes and go live… it works.

IOS i get decent fill rates. Android… not so much. but thats not the codes fault…

[lua]local ads = require “ads” – Required for Banner Ads

–*********************************************
–***** Setup Banner Ads
–*********************************************

if (platformCheck == “Android” or platformCheck == “Win”) then
–ads.init( “inmobi”, “your real Android INMOBI code here” ) --Android InMobi Code
ads.init( “inmobi”, “4028cb962895efc50128fc993f9f025a” ) --Android TEST CODE
print (“InMobi Initialized for ANDROID”)
analytics.init(“Enter your real ANDROID FLURRY code here”) – init Flurry Analytics for the app at the same time
print (“Flurry Initialized for ANDROID”)
else
–ads.init( “inmobi”, “your actual IOS INMOBI code here” ) --IOS InMobi Code
ads.init( “inmobi”, “4028cb962895efc50128fc99d4b7025b” ) --IOS TEST CODE
print (“InMobi Initialized for IOS”)
analytics.init(“Enter your real IOS FLURRY code here”)
print (“Flurry Initialized for IOS”)
end
analytics.logEvent(“Launched Game”)

print("Width ",display.contentWidth)
print("Height ",display.contentHeight)

if display.contentWidth > 468 then – Pick which size banner i want to use based on device screen width.
if display.contentWidth > 728 then
bannerWidth = 728 – Width that fits on Larger Tablets (iPads and Xoom)
bannerHeight = 90
–bannerWidth = 468 – disabled the other ads, to see if this size gets better fill rates and banners on a Xoom.
–bannerHeight = 60
else
bannerWidth = 468 – Width that fits on smaller tablets (Galaxy Tabs / Kindle Fire)
bannerHeight = 60
end
else
bannerWidth = 320 --Width of smallest Phone Screen
bannerHeight = 48
end

print ("Global Banner Width set to : ",bannerWidth)
print ("Global Banner Height set to: ",bannerHeight)
print ("Inmobi Banner to show: ",“banner”…bannerWidth…“x”…bannerHeight)[/lua] [import]uid: 67604 topic_id: 18289 reply_id: 70096[/import]

Thanks! I’ll give that code a try. [import]uid: 16901 topic_id: 18289 reply_id: 70107[/import]

Oh, i forgot to put in the code where the Ads get displayed. this is it:

[lua]------------------------------
– Internet check via Socket

if require(“socket”).connect(“learninggems.com”, 80) == nil then
print(“No INTERNET connection – Ads will not be shown.”)
bannerHeight = 0
else
ads.show( “banner”…bannerWidth…“x”…bannerHeight, { x=((display.contentWidth-bannerWidth)/2), y=0, interval=30, testMode=true } ) – Test mode must be true until we have a real IOS or Android market ID and name.
end[/lua]
[import]uid: 67604 topic_id: 18289 reply_id: 70149[/import]

Thank you! [import]uid: 16901 topic_id: 18289 reply_id: 70256[/import]