2016年2月18日星期四

How To Add Google Admob In Adobe Air Mobile APP

admob ane for flash air iOS app and actionscript android app.include banner and Interstitial native Advertising.
this Admob ANE suport admob 1 and admob 2,not using uuid.using the last sdk.
admob ane for air mobile ad ,support Interstitial and Banner

### init Admob in flash air
```
var admob:Admob=Admob.getInstance();
admob.setKeys("your admob banner id","your admob institial id");
```

### show simple admob banner in adobe air app
```
admob.showBanner(Admob.BANNER,AdmobPosition.BOTTOM_CENTER);
```

###show admob  Interstitial ad (full screen ad)
```
if (admob.isInterstitialReady())// check ad has cached ,if true show it
{
     admob.showInterstitial();
}
else
{
    admob.cacheInterstitial();
}
```
### add admob activity and permission .  you need add in application-app.xml for air android app
```
<android>
        <manifestAdditions><![CDATA[
<manifest android:installLocation="auto">
   <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"/>
    <application>
 <meta-data android:name="com.google.android.gms.version"
        android:value="@integer/google_play_services_version" />
    <activity android:name="com.google.android.gms.ads.AdActivity" android:configChanges="keyboard|keyboardHidden|orientation|screenLayout|uiMode|screenSize|smallestScreenSize" android:theme="@android:style/Theme.Translucent"/>
    </application>
</manifest>
]]></manifestAdditions>
    </android>
```

**more function**
- 1. handler  ad event  like this.
```
admob.addEventListener(AdmobEvent.onBannerReceive,onAdReceived);

protected function onAdReceived(event:AdmobEvent):void
{
    if(event.type==AdmobEvent.onBannerReceive){
trace(event.data.width,event.data.height);
    }
}
```
- 3.get screen size info,old version function
```
admob.getScreenSize()

```
download url https://github.com/lilili87222/admob-for-flash/ 


1 条评论:

  1. Do this hack to drop 2lb of fat in 8 hours

    Over 160k women and men are losing weight with a easy and SECRET "liquids hack" to drop 1-2lbs each night as they sleep.

    It's scientific and works with anybody.

    Here's how you can do it yourself:

    1) Get a glass and fill it half full

    2) Proceed to learn this weight losing HACK

    you'll be 1-2lbs lighter when you wake up!

    回复删除