Skip to main content
Participant
June 1, 2011
Question

Displaying ADs on AIR apps for iOS and Android?

  • June 1, 2011
  • 5 replies
  • 2259 views

I'm currently debating if I should  go ahead with game development on AIR.  I know the game will be fast  and snappy since it's a very simple game.  My main concerns are;

1. Will I be able to display ADs inside the game?

2. Will these ADs be allowed by Apple?

3. What companies are available for ADs?

Thanks!

- Jona

This topic has been closed for replies.

5 replies

Known Participant
October 28, 2012

http://code.google.com/p/flash-for-mobile/

qq讨论群:56892018

version for android http://code.google.com/p/flash-for-mobile/

version for iphone and ipad https://github.com/lilili87222/admob-for-flash

this is a actionscript native extension for developer to ad advertisement to their air mobile application run on iphone or android.it very easy to use

admob for flash android this lib enable you to add admob ad to your flash air application to add native advertisement to your actionscript3 application you just need to do four step

1.replace D:\Program Files\Adobe\Adobe Flash Builder 4.6\sdks\4.6.1\lib\android\lib\resources\android-res.jar with android-res.jar

2. add this config to -app.xml

<android>
<manifestadditions>
<![CDATA[
<manifest android:installLocation="auto">   
<uses-sdk android:targetSdkVersion="11"/> <uses-sdk android:minSdkVersion="8"/>   
<uses-permission android:name="android.permission.INTERNET"/> <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
<application>
<!-- <activity android:name="com.google.ads.AdActivity?" android:configChanges="keyboard|keyboardHidden|orientation"/> --> <activity android:name="com.google.ads.AdActivity?" android:configChanges="keyboard|keyboardHidden|orientation|screenLayout|uiMode|screenSize|smallestScreenSize"/>
</application>

Unknown end tag for </manifest>

]]>
</manifestadditions>
</android>

3.add this config to -app.xml

<extensions>
<extensionid>
so.cuo.ane.Admob
</extensionid>
</extensions>

4. add code to your android air application like follow 

test1(); private function test1():void {   
var admob:Admob=Admob.getInstance(); if(admob.isSupported){   
admob.setUnitId(gid); admob.dispatcher.addEventListener(AdEvent?.onReceiveAd,this.adHandler); admob.dispatcher.addEventListener(AdEvent?.onFailedToReceiveAd,this.adHandler);

// admob.showRelation(AdMobAlignment?.ALIGN_BOTTOM,AdType?.BANNER); 

admob.show(50,100,AdType?.BANNER);
}else{   
trace("not support");
}
}

protected function adHandler(event:AdEvent?):void {   
trace("receive ad");
}
Inspiring
June 2, 2011

Hi  Jona

Here is a link demonstrating adding an ad to you app.

http://www.webkitchen.be/2011/05/17/displaying-ads-in-your-mobile-air-application/

regards Mike

February 29, 2012

where can I add my publisher ID ? I think this code add only the url the site but I can't see the url from the .jar file which download from my account in adMob site. can we add the .jar file in actionscript?

Known Participant
June 1, 2011

Yeah, you could try Admob

admob.com

you'll need to create an account there.

let me know how it goes.

Participant
June 1, 2011

Thanks for your feedback!

How about iOS? Do they care if I embed ADs on the app?  I'm not too familiar with iOS.

Thanks!