Giter VIP home page Giter VIP logo

aneadmob's Introduction

About

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

  • show ad;
  • cache interstitial ad;
  • show interstitial ad;
  • hide ad;
  • listen tap, close, leave, 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:

<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
<application>
<meta-data android:name="com.google.android.gms.version" android:value="4323000" /> <!-- should be 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"/>
</application>

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.init();

...

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


//showing 468x60 ad at the bottom center side of the screen
_admob.show("AD_UNIT_ID", AdParams.SIZE_IAB_BANNER, AdParams.HALIGN_CENTER, AdParams.VALIGN_BOTTOM);

//hide ad
_admob.hide();

//caching and showing interstitial ad
_admob.cacheInterstitial("AD_UNIT_ID");
...
_admob.showInterstitial();

Game with AdMob

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

Misc

ANE is build with AIR13.0, in order to rebuild for another (lower only, no need to do this for higher) version, do the following:

  • edit "air\extension.xml" and change 13.0, in very first line, to any version you need;
  • edit "build.bat" and, in the very last line, change path from AIR13.0 SDK to any AIR SDK you need;
  • execute "build.bat" to repack the ANE.
  • pray, it works! :)

aneadmob's People

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.