flash air application adds ads tutorial

Download flash air ads management library (Advertising ANE )

To display ads in mobile applications need to add ad library to app, 20150801 is the current version of Keymob library , you will find flash air project files and directories in the folder you downloaded, the following resources are Keymob library related. Download the advertising ANE library

Note: the above directory under the src folder can't modify

AdmobAdapter.jar under folder com_keymob_sdks is the default platform,you can change it to other

Add lib to the flash air mobile project

Add using advertising management library need the following a few steps
  1. Copy the keymob1.0.ane to flash air project, and then added it to the build path
  2. Copy com_keymob_sdks to flash air project src folder
  3. If you want to use baidu advertising platform, copy biduad_plugin to flash air project src folder
  4. If you want to use widely platform, copy gdt_plugin to flash air project src folder

Add advertising related as3 code

1. import keymob related classes
    import com.keymob.*;
2. Initialization Keymob
Initialization Keymob library management is the prerequisite to call other advertising functions, the following initialization method is to use the Keymob.com service
KeymobAd.getInstance().initFromKeymobService("1",false);
3. Display advertising
Show the banner ads in the absolute position (0,200)
KeymobAd.getInstance().showBannerABS(AdSizes.BANNER, 0, 200);
Parameters Description

4. Add ads permissions

edit xxx- app.xml To add the necessary permissions reqired by advertising platform

<!-- base permission -->
<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE"/>
<uses-permission android:name="android.permission.READ_PHONE_STATE"/>
<!-- base permission for location-->
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<!-- base permission required by chartboost and baidu-->
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
<!-- permission required by mmedia -->
<uses-permission android:name="android.permission.RECORD_AUDIO" />
<uses-feature android:name="android.hardware.microphone" android:required="false" />
5. Add the advertising Activity configuration information
edit xxx-app.xml Add advertising platform to apply the Activity, app will not be able to display ad if not add platform Activity
    <!-- Admob -->
<meta-data android:name="com.google.android.gms.version" android:value="7327000" /> <activity android:name="com.google.android.gms.ads.AdActivity" android:configChanges="keyboard|keyboardHidden|orientation|screenLayout|uiMode|screenSize|smallestScreenSize" android:theme="@android:style/Theme.Translucent"/>
<!-- Amazon Mobile Ads --> <activity android:name="com.amazon.device.ads.AdActivity" android:configChanges="keyboardHidden|orientation|screenSize"/>

<!-- InMobi --> <activity android:name="com.inmobi.androidsdk.IMBrowserActivity" android:configChanges="keyboardHidden|orientation|keyboard|smallestScreenSize|screenSize" android:theme="@android:style/Theme.Translucent.NoTitleBar" android:hardwareAccelerated="true" />

<!-- Millennial Media --> <activity android:name="com.millennialmedia.android.MMActivity" android:theme="@android:style/Theme.Translucent.NoTitleBar" android:configChanges="keyboardHidden|orientation|keyboard|screenSize" ></activity>

<!-- Keymob --> <activity android:name="com.keymob.sdk.core.KeymobActivity" android:theme="@android:style/Theme.Dialog" android:configChanges="keyboard|keyboardHidden|orientation|screenLayout|uiMode|screenSize|smallestScreenSize" />
<!-- baidu --> <activity android:name="com.baidu.mobads.AppActivity" android:configChanges="keyboard|keyboardHidden|orientation"/>

<!-- adcolony --> <activity android:name="com.jirbo.adcolony.AdColonyOverlay" android:configChanges="keyboardHidden|orientation|screenSize" android:theme="@android:style/Theme.Translucent.NoTitleBar.Fullscreen" /> <activity android:name="com.jirbo.adcolony.AdColonyFullscreen" android:configChanges="keyboardHidden|orientation|screenSize" android:theme="@android:style/Theme.Black.NoTitleBar.Fullscreen" /> <activity android:name="com.jirbo.adcolony.AdColonyBrowser" android:configChanges="keyboardHidden|orientation|screenSize"> android:theme="@android:style/Theme.Black.NoTitleBar.Fullscreen" />

<!-- guang dian tong --> <service android:name="com.qq.e.comm.DownloadService" android:exported="false"/> <activity android:name="com.qq.e.ads.ADActivity" android:configChanges="keyboard|keyboardHidden|orientation|screenSize"/>

More tutorial of add ad in app   qq group 310513042   home