Git Product home page Git Product logo

admob-ane-3's Introduction

admob ane

how to add admob native ad in flash air application run on ios and android ?
this adobe native extention(https://github.com/lilili87222/admob-for-flash/) make it easy,
and I will show how to use it .
Make sure you have had admob account(www.admob.com) and created a application before continue.
download:https://github.com/lilili87222/admob-for-flash/archive/master.zip and get the lib file admob20151115.ane

admob ane 201910101 for air mobile ad ,support Interstitial and Banner
support landscape and portrait and autoOrient
support ios and android
support all native event
builed on admob ios sdk 7.35 and admob android sdk(Google Play services 17) 17

if you want to use it ,you need update air sdk to 30.0 or higher

  1. Import the API Classes
import so.cuo.platform.admob.*;

2.we create a simple admob banner ad .Get the Admob instance and set the admob ID
if want to set admob interstitial with a separate ID ,set the second parameter of setKeys.
then show the admob banner at bottom center of screen.


var admob:Admob=Admob.getInstance();
 Admob.getInstance().initAdmobSDK("your admob app ID");
admob.showBanner("your banner id ",Admob.SMART_BANNER,AdmobPosition.BOTTOM_CENTER);

3.create and show interstitial.
Get the admob instance and set the admob ID,the first ID is the banner ID
and the second ID is interstitial ID. then call cacheInterstitial to load ad,
if load success isInterstitialReady return will true,call showInterstitial to show full screen ad

var admob:Admob=Admob.getInstance();
admob.setKeys("your admob banner","your admob institial");////replace this fake ID with your really ID
if (admob.isInterstitialReady())// check ad has cached ,if true show it
{
     admob.showInterstitial();
}
else
{
    admob.cacheInterstitial("your interstitial id");
}

if want to add admob in android application.you need change the application-app.xml file .
add uses permission and activity replace ca-app-pub-3940256099942544~3347511713 with your admob app id

<android>
        <manifestAdditions><![CDATA[
			<manifest android:installLocation="auto">
			    <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
			    <uses-permission android:name="android.permission.ACCESS_WIFI_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"/>


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


			     </application>
			</manifest>
		]]></manifestAdditions>
    </android>

more function

    1. handler ad event like this.
admob.addEventListener(AdmobEvent.onBannerReceive,onAdReceived);
    1. get ad size info
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()

contact:[email protected]

if user like this lib,you can download and review our game
https://itunes.apple.com/us/artist/phonegame/id553087275?mt=8
donate and download more ane
http://www.cuo.so/ane-list/index.html

admob-ane-3's People

Contributors

lilili87222 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.