Skip to content

luc4smoreira/ANEAdMob

 
 

Repository files navigation

News

2020-08-03

  • Updated to the last version 19.3.0.
  • Batch file to build ANE 32bits, 64 or 32&64bit versions as 1 ANE
    Big thanks to @luc4smoreira for this update!

2020-07-30

  • Rewarded videos
  • Support for AndroidStudio with Gradle
  • Batch file to build SWC and JAR
  • Updated to the latest version of Adobe AIR SDK 33 and Google Play Services 16.0.0.
    Big thanks to @luc4smoreira for this update!

2020-01-29

  • Updated to the latest version of Adobe AIR SDK 33 and Google Play Services 11.0.4.
  • 32-bit version works fine.
  • 64-bit ANE was tested by some good guy, and he told me it worked fine too. :)

About

ANEAdMob is an Adobe AIR native extension (ANE) for Android to show ads without Firebase.
Supported functionality:

  • show ad;
  • cache interstitial ad;
  • cache rewarded video ad;
  • show interstitial ad;
  • show rewarded video ad;
  • hide ad;
  • listen tap, close, leave, rewarded, failed, etc. event.

Docs

Please, read docs and try ANE before asking any questions.
https://developers.google.com/mobile-ads-sdk/
http://help.adobe.com/en_US/air/extensions/index.html

Installation

Extension ID: com.pozirk.ads.AdMob
Add "AdMob.ane" and "air\AdMob\bin\AdMob.swc" to your AIR project.
Add the following lines to your AIR Aplication-app.xml file inside <manifestAdditions> section:
Add your AdMob App ID to the value of tag with name com.google.android.gms.ads.APPLICATION_ID, as shown below.


<![CDATA[<manifest android:installLocation="auto">
<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>

<meta-data android:name="com.google.android.gms.ads.APPLICATION_ID" android:value="ca-app-pub-xxxxxxxxxxxxxxxx~yyyyyyyyyy" />

<application>
<meta-data android:name="com.google.android.gms.version" android:value="12451000" />
<activity android:name="com.google.android.gms.ads.AdActivity" android:configChanges="keyboard|keyboardHidden|orientation|screenLayout|uiMode|screenSize|smallestScreenSize"/>
</application>
</manifest>]]>

Example

import com.pozirk.ads.admob.AdMob;
import com.pozirk.ads.admob.AdParams;
import com.pozirk.ads.admob.AdEvent;

...

protected var _admob:AdMob = new AdMob();

...

//> initialization of AdMob
_admob.addEventListener(AdEvent.INIT_OK, onEvent);
_admob.addEventListener(AdEvent.INIT_FAIL, onEvent);
_admob.addEventListener(AdEvent.BANNER_SHOW_OK, onEvent);
_admob.addEventListener(AdEvent.BANNER_SHOW_FAIL, onEvent);
_admob.addEventListener(AdEvent.BANNER_LEFT_APP, onEvent);
_admob.addEventListener(AdEvent.BANNER_OPENED, onEvent);
_admob.addEventListener(AdEvent.BANNER_CLOSED, onEvent);
_admob.addEventListener(AdEvent.INTERSTITIAL_SHOW_OK, onEvent);
_admob.addEventListener(AdEvent.INTERSTITIAL_SHOW_FAIL, onEvent);
_admob.addEventListener(AdEvent.INTERSTITIAL_CACHE_OK, onEvent);
_admob.addEventListener(AdEvent.INTERSTITIAL_CACHE_FAIL, onEvent);
_admob.addEventListener(AdEvent.INTERSTITIAL_LEFT_APP, onEvent);
_admob.addEventListener(AdEvent.INTERSTITIAL_OPENED, onEvent);
_admob.addEventListener(AdEvent.INTERSTITIAL_CLOSED, onEvent);
_admob.addEventListener(AdEvent.REWARDED_CACHE_FAIL, onEvent);
_admob.addEventListener(AdEvent.REWARDED_CACHE_OK, onEvent);
_admob.addEventListener(AdEvent.REWARDED_CLOSED, onEvent);
_admob.addEventListener(AdEvent.REWARDED_COMPLETED, onEvent);
_admob.addEventListener(AdEvent.REWARDED_LEFT_APP, onEvent);
_admob.addEventListener(AdEvent.REWARDED_OPENED, onEvent);
_admob.addEventListener(AdEvent.REWARDED_REWARDED, onEvent);
_admob.addEventListener(AdEvent.REWARDED_STARTED, onEvent);
_admob.init();

...

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


//showing smart-size ad at the bottom center side of the screen
//Admob official test ad unit for  banner "ca-app-pub-3940256099942544/6300978111"
_admob.show("AD_UNIT_ID", AdParams.SIZE_SMART_BANNER, AdParams.HALIGN_CENTER, AdParams.VALIGN_BOTTOM); 

//hiding ad
_admob.hide();

//caching interstitial ad
//Official test ad unit for interstitial "ca-app-pub-3940256099942544/1033173712"
_admob.cacheInterstitial("AD_UNIT_ID"); 
...
//showing interstitial ad, make sure it's cached first
_admob.showInterstitial();
...


//caching rewarded ad
//Official test ad unit for rewarded "ca-app-pub-3940256099942544/5224354917"
_admob.cacheRewarded("AD_UNIT_ID");  
...
//showing rewarded ad, make sure it's cached first
_admob.showRewarded();
...

//setting volume of the interstitial ad, can have sound, if it's video
_admob.setVolume(vol); //0-1 range, where 0 - mute, 1 - max volume (default, I guess).

Games with AdMob

https://play.google.com/store/apps/details?id=air.com.pozirk.allinonesolitaire.old
In order to see the interstitial ad, you need to win/lose any game.

Packages

No packages published

Languages

  • Java 77.6%
  • ActionScript 18.6%
  • Batchfile 3.8%