Git Product home page Git Product logo

admobane-1's Introduction

##News: 22/08/2014
Version update 1.7.8. Please see the ReleaseNotes for fll release details

16/08/2014
New Version has been release! Ver. 1.7.7
Added features:

  • Updated iOS SDK to 6.11.1
  • Move Banner Function
  • Added support for the new Large Banner type! (Not available in iOS4.3 build)
  • Get banner dimensions
  • Get Device Screen dimensions
  • Set rendering mode (Hardware/Software/None) *Android Only
  • Fixed Minor bugs
    See ReleaseNotes for more details

Admob Native Extension for Adobe Air

This AdMob will add the support to use AdMob Mobile monetization platform with Adobe Air. The Extension support Android Platform and iOS Platform. Different Packages are available according to the application targets:

  • Android Only
  • iOS Oly
  • Both Platforms

##Admob SDK Details

  • Android: Google Play services ver. 5.0
  • iOS: Admob SDK 6.11.1 (Admob SDK 6.8.0 in iOS 4.3 compatible version)

##Device Compatibility: Android: From version 2.3
iOS: From version 4.3

##Features:

  • Set Render mode type (Android Only)
  • Set Specific test Device ID
  • Create Single or Multiple Banners for Application
  • Move Banner, allow also to animate the banner
  • Full Interstitial Ads Management and Pre-caching
  • Full Request Customization
  • Get Banner Dimensions
  • Get Device Screen Dimension
  • Custom Absolute Position
  • Auto relative Docking position for:
TOP_LEFT
TOP_CENTER
TOP_RIGHT
MIDDLE_LEFT
MIDDLE_CENTER
MIDDLE_RIGHT
BOTTOM_LEFT
BOTTOM_CENTER
BOTTOM_RIGHT
  • Support Any adMob Size:
BANNER
MEDIUM_RECTANGLE
LARGE_BANNER
FULL_BANNER
LEADERBOARD
WIDE_SKYSCRAPER
SMART_BANNER
SMART_BANNER_PORT
SMART_BANNER_LAND

##Install the library Add the AdMob ANE library to your project.
In Flash Builder 4.7:

  1. Go to Project Properties
  2. Select Native Extensions under Actionscript Build Path
  3. Choose Add ANE... and navigate to the AdMob.ane file
  4. Select Actionscript Build Packaging > Google Android, Apple IOS or Both
  5. Select the Native Extensions tab, and click the 'Package' check box next to the extension

Please note:
When adding the ANE be sure to have the checkbox "Update Air Application Descriptor" selected.
If it is not selected make certain that the application Id is available in the Air Application Descriptor as follow:

<extensions>
	<extensionID>com.codealchemy.ane.admobane</extensionID>
</extensions>

##Usage Import the library

import com.codealchemy.ane.admobane.AdMobManager;

Get The Manager Instance

var adMobManager:AdMobManager = AdMobManager.manager;

Check Extension Support

if(adMobManager.isSupported){
    ...
}

Set Manager Verbose Mode [Optional]
The Verbose mode will allow to have debug output from all places, AS, Java and iOS console

adMobManager.verbose = true;

Set The Render mode [Optional, default Hardware]
This setting will allow to set the render mode for the banner.
The available setting are None, Hardware and Software. The use of the render mode vary according to the application.

adMobManager.renderLayerType = AdMobManager.RENDER_TYPE_HARDWARE;

Set Manager Operation Mode [Optional... Until Operation]
This setting will allow to set the extension in either test mode or operation mode.
By default the extension will work in Test Mode, when the application needs to be release it will be needed to switch the operation into Production mode

adMobManager.operationMode = AdMobManager.TEST_MODE;

Set The test device ID
This setting will prevent impression counts during testing for the specified ID.

adMobManager.testDeviceID = "MY_DEVICE_ID";

Set Common AdMob Unit Id for Banners [Recommended] Setting a common Admob Id will allow to avoid to specify an Id during banner creation If the manager has an adMob unit id set all the banner will be created using that id, unless a new id s specified during banner creation. In that case the banner will use the id included on its parameters.

adMobManager.bannersAdMobId = "ADMOB_BANNER_ID";

Set Common AdMob Unit Id for interstitial [Recommended] Same as for the banner the common AdMob Id for interstitial will be use for any interstitial created unless a new id is given during interstitial creation. In that case the interstitial will use the id included on its parameters.

adMobManager.interstitialAdMobId = "ADMOB_INTERSTITIAL_ID";

Set Gender Request Targeting [Optional] This setting allow to create the ad request specifically for a gender. Please note that all banner created after will included the given gender. Request targeting option can be update before the creation of new banner for offer different target banner.

adMobManager.gender = AdMobManager.GENDER_MALE;

Set Birthday Request Targeting [Optional] This setting allow to have specific banner for a given age If wish to set the age range then the year will be mandatory, while month and day can be optional. If month and day are not specified the default value of 1 will be used. Request targeting option can be update before the creation of new banner for offer different target banner.

adMobManager.birthYear = 1996;
adMobManager.birthMonth = 1;
adMobManager.birthDay = 24;

Set the Tag for child directed treatment [Optional] This setting allow to have specific banner for a children in accordance to Children's Online Privacy Protection Act (COPPA). Request targeting option can be update before the creation of new banner for offer different target banner.

adMobManager.isCDT = true;

This getter will allow to get the current quantity of banner created and available in the Manager

var num:int = adMobManager.bannersQuantity;

This getter will allow to get all the banners id of banner created and available in the Manager

var bannerIds:Array = adMobManager.bannersNames;

This getter will allow to get the information of which device is currently in use (Android or iOS)

var device:String = adMobManager.device;

Get the Current Screen Size

var screenSize:ScreenSize =  AdsManager.getScreenSize();

Get a Standard Banner Size

var adSize:AdSize =  AdsManager.getBannerSize(AdMobSize.BANNER);

Get the Specific and actual Banner Size in pixels after the banner Creation

var adSize:AdSize =  AdsManager.getExistingBannerSize("BottomBanner");

Create an AdMob Banner in an relative Position
The parameter ae as follow:

  • Banner Size (Banner specific size)
  • Banner Position (Banner specific Position)
  • Banner Id (Useful when you wish to create more than one banner.If an id is not specified a random id will be generated)
  • AdMobId (Banner specific AdMobId, Useful if you are tracking the banner result assigning individual id. If an id is not specified the common id will be used.)
  • AutoShow Option (This option allow to automatically show the banner one it is loaded.)
adMobManager.createBanner(AdMobSize.BANNER,AdMobPosition.BOTTOM_CENTER,"BottomBanner", null, true);

Create an AdMob Banner in an absolute Position
The parameter ae as follow:

  • Banner Size (Banner specific size)
  • Banner X Position (Banner specific X Position)
  • Banner Y Position (Banner specific Y Position)
  • Banner Id (Useful when you wish to create more than one banner.If an id is not specified a random id will be generated)
  • AdMobId (Banner specific AdMobId, Useful if you are tracking the banner result assigning individual id. If an id is not specified the common id will be used.)
  • AutoShow Option (This option allow to automatically show the banner one it is loaded.)
adMobManager.createBannerAbsolute(AdMobSize.BANNER,100, 200, "BottomBanner", null, true);

Move a specific Banner after creation

The function will allow to move a specific banner, recognized by its Id.
This allow to also create banner animation when the banner is created
The parameter are as follow:

  • Banner Id (Specific banner Id for the banner to be move)
  • Banner X Position (Banner specific X Position)
  • Banner Y Position (Banner specific Y Position)
adMobManager.moveBanner("BottomBanner",0,100);

Show a specific Banner
The function will allow to show a specific banner, recognized by its Id.
This is specifically useful when your app wish to manage several ads.
The parameter are as follow:

  • Banner Id (Specific banner Id for the banner to be show)
adMobManager.showBanner("BottomBanner");

Hide a specific Banner
The function will allow to hide a specific banner, recognized by its Id.
This is specifically useful when your app wish to manage several ads.
The parameter are as follow:

  • Banner Id (Specific banner Id for the banner to be hide)
adMobManager.hideBanner("BottomBanner");

Remove a specific Banner
The function will allow to remove a specific banner, recognized by its Id.
This is specifically useful when your app wish to manage several ads.
The parameter are as follow:

  • Banner Id (Specific banner Id for the banner to be moved)
adMobManager.removeBanner("BottomBanner");

Show all existing banners
The function will show all available banners

adMobManager.showAllBanner();

Hide all existing banners
The function will hide all available banners

adMobManager.hideAllBanner();

Remove all existing banners
The function will remove all available banners

adMobManager.removeAllBanner();

Create the AdMob Interstitial
The parameter are as follow:

  • Interstitial AdMobId (specific AdMobId. If an id is not specified the common id will be used.)
  • AutoShow Option (This option allow to automatically show the Interstitial one it is loaded.)
adMobManager.createInterstitial(null,true);

Show the AdMob Interstitial
The function will show the cached AdMob Interstitial

adMobManager.showInterstitial();

Check the Interstitial load state

var state:Boolean = adMobManager.isInterstitialLoaded();

Remove the AdMob Interstitial
The function will allow to remove the Interstitial when needed.
This is specifically usefull when there is the need to remove an Interstitial without the user interaction.

adMobManager.removeInterstitial();

##Listen to Events In order to listen to event you need to attache the event listener to the extension dispatcher.
The easiest way is to create an internal dispatcher instance:

private function get dispatcher():EventDispatcher
{ return adMobManager.dispatcher; }

Then you can add all the listener for the event you need:

    dispatcher.addEventListener(AdMobEvent.BANNER_LOADED, onBannerLoaded);

static private function onBannerLoaded(e:AdMobEvent):void
{
    // Do Something...
}

The event will also pass the banner id for the banner who did dispatch the event.
The example above will show all the banner, if you wish to, for example, show only
the specific banner who did dispatch the event you can do as follow:

static private function onBannerLoaded(e:AdMobEvent):void
{
    // Show the specific banner who did dispatch the event
    adMobManager.showBanner(e.data);
}

The Extension available Event are as follow:

BANNER_LOADED
BANNER_FAILED_TO_LOAD
BANNER_AD_OPENED
BANNER_AD_CLOSED
BANNER_LEFT_APPLICATION
INTERSTITIAL_LOADED
INTERSTITIAL_FAILED_TO_LOAD
INTERSTITIAL_AD_OPENED
INTERSTITIAL_AD_CLOSED
INTERSTITIAL_LEFT_APPLICATION

##Setup for Android Update Your Application Descriptor
You'll need to be using the AIR 3.1 SDK or higher, include the extension in your Application Descriptor XML, and update the Android Manifest Additions with additional settings.
Add the following settings in "manifest" tag.

<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />

Add the following settings in "application" tag.

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


Copyright 2011-2015 Code Alchemy inc.

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

admobane-1's People

Contributors

code-alchemy avatar

Watchers

 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.