Got Admob working for Android :)

Fill rates in my none corona apps with correct admob sdk are around 90% but with the web hack its about 30%.

I think it maybe because Admob can search your iphone app page on itunes and target ads to the type of app, where the web app is generic and cant be monitored correctly.

Hopefully Corona will have a proper integration one day;( [import]uid: 11459 topic_id: 8021 reply_id: 33665[/import]

For the life of me I can’t get this to work nothing pops up mabe its my admob account or something i dontknow but i think ill just wait until its officially supported [import]uid: 35973 topic_id: 8021 reply_id: 33925[/import]

EDIT: Got it working. My game is on landscape mode, so I needed to change the x,y coords, plus my phone was on airplane mode lol.

[import]uid: 48372 topic_id: 8021 reply_id: 34868[/import]

This doesn’t work on Android 3.0. I copied the files and input my admob publisher id. Nothing. [import]uid: 4596 topic_id: 8021 reply_id: 36806[/import]

MOST WANTED:
build-in ads support and android in-game purchase, openfeint :smiley: [import]uid: 9190 topic_id: 8021 reply_id: 37010[/import]

I tried this code on my iphone and my ads aren’t showing, I guess there’s no fill at the moment?

Then I tested the other setup from the link and then the ad didn’t popup, instead the ad opened in the little adbanner… wonder how to fix that? [import]uid: 34126 topic_id: 8021 reply_id: 37074[/import]

Got this working on android and iOS. I’ll update in detail later. The above code works fine for android on all devices - except 3.0.

The original code from http://www.ludicroussoftware.com/tag/corona/ works fine on iOS, except you should change this line:

to:

so that the advert increases in size on iPad.

You should also add this to the ad.html to refresh the ads:

This would refresh every 30 seconds. On the admob server set the refresh to less than this. I use 20 seconds. [import]uid: 8872 topic_id: 8021 reply_id: 37494[/import]

To what? From what? :frowning: [import]uid: 23229 topic_id: 8021 reply_id: 37501[/import]

I’ve tried this code now and it works fine, but recently it have come to my knowledge from some forums that it is possible to change the publisher id inside the html when you have a jailbroken device.

I wonder if it is possible to add the publisher id inside the build.settings and call it from there or if the entire adMob code can be embedded inside a lua file?

I don’t have the skills to pull this off but maybe someone with more experience could pull this off and share the code?

Thanks.
David [import]uid: 34126 topic_id: 8021 reply_id: 38178[/import]

A little update:

Currently admob aren’t serving ads to android 3+ over this interface, and this is why tablets don’t show ads. You should check in your code if the current version is > 3 and disable the webpopup:

Something like this:

ads = true  
if system.getInfo( "platformName" ) == "Android" then  
 local AndroidVersion = string.sub (system.getInfo( "platformVersion" ), 1, 1)  
 if tonumber(AndroidVersion) \< 3 then  
 ads = false  
 end  
end  

There is a way to get around this, so if you have a tablet centric app and desperately need ads on 3.0+ then give me a shout on irc and i’ll help you out.

Another note. The webpopup will only zoom the ad 1.5 at the most. So to make sure your web popup isnt too big you need to do this:

 local sizeX = 320  
 local sizeY = 48  
 local scale = 1/display.contentScaleY  
 if scale \> 1.5 then   
 adfile = "android\_ad15.html"  
 sizeX = sizeX\*(1.5/scale) + 1  
 sizeY = sizeY\*(1.5/scale) + 1  
 else  
 adfile = "android\_ad.html"  
 end  

And then make your webpopup sizeX by sizeY.

[import]uid: 8872 topic_id: 8021 reply_id: 39457[/import]

kam187,

I almost have this working…but am not sure what the difference is between the android_ad.html and android_ad15.html? Do I need to open android_ad.html and make a few tweaks to the html and “save as” ad15?

Also, is there any harm in serving live ads during testing my app? I had the html parm “test:true” for awhile…but then switched to “test:false” and got live ads…being new to the whole ad thing…not sure if serving live ads is bad during testing.

Thanks for all the help,
Paul [import]uid: 39506 topic_id: 8021 reply_id: 40450[/import]

Hi Kam,

Thanks for sharing useful info.

If we are doing this for Android, shouldn’t this line be changed:

src=“http://mmv.admob.com/static/iphone/iadmob.js

It is referring iphone/iadmob.js .

Should it not be changed to the android url instead?

Where can I get the correct url for android?

Again, thanks for sharing, appreciate it very much! [import]uid: 64189 topic_id: 8021 reply_id: 41269[/import]

The same script is used for iPhone and android. There isn’t a seperate URL for android. Admob check for an android useragent and switch to android ads automatically. [import]uid: 8872 topic_id: 8021 reply_id: 41271[/import]

Thanks for the help kam187. Got it working using your method! App is in the market and adds are working really well. Really on 2 issues (probably on my part). I get around 85% fill rate…guess some ads are not served up for some reason…and the webpopup shifts right on the screen about 100 pixels when first opened on the game screen.

Besides those little things…working great. Thanks for sharing! BTW, can’t wait for your base2 blog update…loved reading what you had so far! Will for sure read your suspend/resume writeup when its posted. [import]uid: 39506 topic_id: 8021 reply_id: 41276[/import]

kam187,

You are the best!! That is perfect. Without your help, I could not have gotten ads working in my game!

I just updated my game (Color Confusion http://bit.ly/kSX8go) last night for some minor bugs and a few tweaks based on user feedback.

In my next update, I will make the 1.5 tweaks.

BTW, we have installed your game on all our tablets (Asus Transformer x2 and Viewsonic GTab)…everyone loves playing it!

[import]uid: 39506 topic_id: 8021 reply_id: 41279[/import]

when i change ad.html “test:true” to “test:false”, the webpopup no longer show up. why? please help,thanks. [import]uid: 47530 topic_id: 8021 reply_id: 41637[/import]

The fill rate is just admob not having enough ads to send you. My fill rate is about the same. If the ads weren’t displaying for some reason admob just wouldn’t count them :slight_smile:

With regards to the ad jumping around, you need to use the check in my last post. To make it clearer here’s all the code in one shot!

Use DisplayAd(delay) to display an ad in ‘delay’ seconds.
Use RemoveAd(delay) to remove an ad in ‘delay’ seconds.

This code will draw a white rect in place of the ad on the simulator so you can see where it will be :slight_smile:

[All code moved to first post]

[import]uid: 8872 topic_id: 8021 reply_id: 41278[/import]

Wierd! I pasted it but it didnt post.

Change this:

[All code moved to first post] [import]uid: 8872 topic_id: 8021 reply_id: 37543[/import]

You need to add the permissions from the first post if you’re on android. Also you need to setup admob, and you’re id. I’ll update the first post with all the info!

EDIT: first post updated with all info. [import]uid: 8872 topic_id: 8021 reply_id: 41719[/import]

Having trouble with this…followed all instructions
no errors in console but nothing appears in simulator in test mode
no white rectangle nada…
[import]uid: 67514 topic_id: 8021 reply_id: 41768[/import]