守望者--AIR技术交流

标题: 亚马逊广告ANE [打印本页]

作者: 破晓    时间: 2015-1-30 17:02
标题: 亚马逊广告ANE
About

ANEAmazonAds is an Adobe AIR native extension (ANE) for Kindle tablets (and others Android devices) to show Amazon Ads.
Supported functionality:

Docs

Please, read docs and try ANE before asking any questions.
https://developer.amazon.com/appsandservices/apis/earn/mobile-ads
http://help.adobe.com/en_US/air/extensions/index.html

Installation

Extension ID: com.pozirk.ads.AmazonAds
Add "AmazonAds.ane" and "air\AdMob\bin\AmazonAds.swc" to your AIR project.
Add the following lines to your AIR Aplication-app.xml file inside <manifestAdditions> section:

  1. <uses-permission android:name="android.permission.INTERNET"/>
  2. <uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
  3. <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
  4. <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
  5. <application>
  6. <activity android:name="com.amazon.device.ads.AdActivity" android:configChanges="keyboardHidden|orientation|screenSize"/>
  7. </application>
复制代码
Internet permission is mandatory, others are optional.Example
  1. import com.pozirk.ads.amazon.AmazonAds;
  2. import com.pozirk.ads.amazon.AdParams;
  3. import com.pozirk.ads.amazon.AdEvent;

  4. ...

  5. protected var _amazonAds:AmazonAds = null;

  6. ...

  7. //> initialization of AmazonAds
  8. _amazonAds = new AmazonAds();
  9. _amazonAds.addEventListener(AdEvent.AD_LOADED, onEvent);
  10. _amazonAds.addEventListener(AdEvent.AD_FAILED_TO_LOAD, onEvent);
  11. _amazonAds.addEventListener(AdEvent.AD_EXPANDED, onEvent);
  12. _amazonAds.addEventListener(AdEvent.AD_COLLAPSED, onEvent);
  13. _amazonAds.init("YOUR_APP_ID");
  14. _amazonAds.enableLogging(true); //for debug only!
  15. _amazonAds.enableTesting(true); //for debug only!
  16. //<

  17. ...

  18. protected function onEvent(ae:AdEvent):void
  19. {
  20.     trace(ae.type+" "+ae._data);
  21. }
  22. //<


  23. //showing 600x90 ad at the bottom center side of the screen
  24. _amazonAds.show(AdParams.SIZE_600x90, AdParams.HALIGN_CENTER, AdParams.VALIGN_BOTTOM);
  25. _amazonAds.setTimeout(30000); //set timeout (in milliseconds) to load new ad, not sure if it works properly...

  26. //caching interstitial
  27. _amazonAds.cacheInterstitial();

  28. //showing interstitial
  29. _amazonAds.showInterstitial();
复制代码
Game with Amazon Mobile Adswww.amazon.com/Pozirk-Games-All-in-One-Mahjong-FREE/dp/B00JQHVJSU/
If Amazon Ads don't work (no fill), game will fall back to AdMob.
In order to see the interstitial ad, you need to win/lose any game.
MiscANE is build with AIR14.0, in order to rebuild for another version (prior 14.0) do the following:





[attach]735[/attach]



相关链接:

https://github.com/pozirk/ANEAmazonAds






欢迎光临 守望者--AIR技术交流 (http://www.airmyth.com/)