ANEAdMob is a native extension for Android to show ads. Among the supported functionality are the ability to show ad, cache interstitial ad, show interstitial ad, hide ad and listen to tap, close, leave, etc. events. When showing an ad, it’s possible to choose its size and location on the screen.
The position of an ad can be customized based on pre-defined constants. A developer can control the vertical and horizontal position of an ad, for instance centralizing it horizontally and pushing it to the bottom of the screen vertically.
Sample
_admob = new AdMob(); _admob.addEventListener(AdEvent.INIT_OK, onEvent); _admob.addEventListener(AdEvent.INIT_FAIL, onEvent); _admob.addEventListener(AdEvent.AD_SHOW_OK, onEvent); _admob.addEventListener(AdEvent.AD_SHOW_FAIL, onEvent); _admob.addEventListener(AdEvent.PRESENT_SCREEN, onEvent); _admob.addEventListener(AdEvent.DISMISS_SCREEN, onEvent); _admob.addEventListener(AdEvent.LEAVE_APPLICATION, onEvent); _admob.addEventListener(AdEvent.INTERSTITIAL_CACHE_OK, onEvent); _admob.addEventListener(AdEvent.INTERSTITIAL_CACHE_OK, onEvent); _admob.addEventListener(AdEvent.INTERSTITIAL_CLOSED, onEvent); _admob.init("YOUR_PUBLISHER_ID"); protected function onEvent(ae:AdEvent):void { trace(ae.type+" "+ae._data); } //showing 468x60 ad at the bottom center side of the screen _admob.show(AdParams.SIZE_IAB_BANNER, AdParams.HALIGN_CENTER, AdParams.VALIGN_BOTTOM); //caching and showing interstitial ad _admob.cacheInterstitial(); ... _admob.showInterstitial();
https://code.google.com/p/flash-air-admob-ane-for-ios/ is more friendly
Thanks for the tip, jake! I already added the ANE you suggested a few weeks ago. It has a simpler API indeed, additionally it works on Android and iOS.
This example code is sufficient for showing google ad in AIR application.
please give me a info about this cause i new in action script.
Hi there! The example is intended to give a glimpse of the API, so a developer can decide if that’s an easy to use ANE or not. I advise you to check the ANE’s Github repository, you will probably find a complete and working example there.
Thank you Dovyski..
can you please send me link of whatever you suggest me like (Github repository) and another helpful example related to admob ad for AIR application.
You’re welcome! The link is: https://github.com/pozirk/ANEAdMob (it’s the same link at the beginning of this article).
If you don’t find any example there, try contacting the author on twitter: @pozirk
thanku Dovyski:-I am happy with this information but i want to step by step information about ad mob because i am new in action script programming.
And i have 2-3 game ready to upload on play store, but i want to ad admob in my games for future earning.And i don’t have knowledge about admob programming.
please help me.
After using this example banner ad is successfully run but interstitial ad not run. So What is the Reason behind it.
I’ve seen problems like that. Sometimes the version between the ANE and the service SDK are different, which breaks some functionality.
Try to ping @pozirk for more info on that.
a new version ane for admob is available ,support new version admob(admob 2) and new ad id formation
http://code.google.com/p/flash-air-admob-ane-for-ios-and-android/