ANEAmazonAds is an Adobe AIR native extension (ANE) for Kindle tablets (and others Android devices) to show Amazon Ads.
Supported functionality:
- show ad;
- hide ad;
- cache interstitial;
- show interstitial;
- listen tap, close, etc. event.
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
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:
<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
<application>
<activity android:name="com.amazon.device.ads.AdActivity" android:configChanges="keyboardHidden|orientation|screenSize"/>
</application>
Internet permission is mandatory, others are optional.
import com.pozirk.ads.amazon.AmazonAds;
import com.pozirk.ads.amazon.AdParams;
import com.pozirk.ads.amazon.AdEvent;
...
protected var _amazonAds:AmazonAds = null;
...
//> initialization of AmazonAds
_amazonAds = new AmazonAds();
_amazonAds.addEventListener(AdEvent.AD_LOADED, onEvent);
_amazonAds.addEventListener(AdEvent.AD_FAILED_TO_LOAD, onEvent);
_amazonAds.addEventListener(AdEvent.AD_EXPANDED, onEvent);
_amazonAds.addEventListener(AdEvent.AD_COLLAPSED, onEvent);
_amazonAds.init("YOUR_APP_ID");
_amazonAds.enableLogging(true); //for debug only!
_amazonAds.enableTesting(true); //for debug only!
//<
...
protected function onEvent(ae:AdEvent):void
{
trace(ae.type+" "+ae._data);
}
//<
//showing 600x90 ad at the bottom center side of the screen
_amazonAds.show(AdParams.SIZE_600x90, AdParams.HALIGN_CENTER, AdParams.VALIGN_BOTTOM);
_amazonAds.setTimeout(30000); //set timeout (in milliseconds) to load new ad, not sure if it works properly...
//caching interstitial
_amazonAds.cacheInterstitial();
//showing interstitial
_amazonAds.showInterstitial();
www.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.
ANE is build with AIR14.0, in order to rebuild for another version (prior 14.0) do the following:
- edit "air\extension.xml" and change 14.0 in very first line to any SDK you need;
- edit "build.bat" and in the very last line change path from AIR14.0 SDK to any AIR SDK you need;
- execute "build.bat" to repack the ANE.