Package | com.milkmangames.nativeextensions.android |
Class | public class AdMob |
Inheritance | AdMob Object |
Property | Defined By | ||
---|---|---|---|
isSupported : Boolean [static] [read-only]
Returns true if the platform is Android supporting AdMob. | AdMob |
Method | Defined By | ||
---|---|---|---|
addEventListener(type:String, listener:Function, useCapture:Boolean = false, priority:int = 0, useWeakReference:Boolean = false):void [static]
Registers an event listener object with an EventDispatcher object so that the listener receives notification of an event. | AdMob | ||
destroyAd():void [static]
Destroys the current ad. | AdMob | ||
getTestDeviceIDs():Vector.<String> [static]
Get an array containing the Test Device ID for your current device; you can pass this to the showAd() function during testing. | AdMob | ||
init(publisherId:String):void [static]
Initialize the AdMob interface. | AdMob | ||
refreshAd():void [static]
Refresh the ad currently on display. | AdMob | ||
removeEventListener(type:String, listener:Function, useCapture:Boolean = false):void [static]
Removes a listener from the EventDispatcher object. | AdMob | ||
setVisibility(visible:Boolean):void [static]
Sets the visibility of the current ad. | AdMob | ||
showAd(type:String, horizontalAlign:String, verticalAlign:String, testDevices:Vector.<String> = null, offsetX:int = 0, offsetY:int = 0):void [static]
Displays a new Ad
| AdMob |
Event | Summary | Defined By | ||
---|---|---|---|---|
Dispatched when ad has failed to load after a call to showAd() | AdMob | |||
Dispatched when a user action on an ad causes the focus to change elsewhere | AdMob | |||
Dispatched when ad has successfully loaded following a call to AdMob.showAd() | AdMob | |||
Dispatched when a fullscreen interactive ad viewv is dismissed by the ad | AdMob | |||
Dispatched when a fullscreen interactive ad view is presented by an ad | AdMob |
Constant | Defined By | ||
---|---|---|---|
VERSION : String = 1.0.6 [static]
Current API Version
| AdMob |
isSupported | property |
isSupported:Boolean
[read-only] Returns true if the platform is Android supporting AdMob.
public static function get isSupported():Boolean
addEventListener | () | method |
public static function addEventListener(type:String, listener:Function, useCapture:Boolean = false, priority:int = 0, useWeakReference:Boolean = false):void
Registers an event listener object with an EventDispatcher object so that the listener receives notification of an event.
Parameters
type:String — event type (AdMobEvent or AdMobErrorEvent)
| |
listener:Function — The listener function that processes the event.
| |
useCapture:Boolean (default = false ) — Determines whether the listener works in the capture phase or the target and bubbling phases.
| |
priority:int (default = 0 ) — The priority level of the event listener. Priorities are designated by a 32-bit integer.
| |
useWeakReference:Boolean (default = false ) — Determines whether the reference to the listener is strong or weak.
|
Error — if AdMob.init has not been called
|
See also
destroyAd | () | method |
public static function destroyAd():void
Destroys the current ad. Throws an error if no ad is currently active.
Error — if AdMob.init has not been called
| |
Error — if there is no current ad to destroy
|
getTestDeviceIDs | () | method |
public static function getTestDeviceIDs():Vector.<String>
Get an array containing the Test Device ID for your current device; you can pass this to the showAd() function during testing. Remember to remove it before publishing your application, so as not to display test ads to end users.
ReturnsVector.<String> — array containing current device's test ID
|
Error — if AdMob.init has not bee ncalled
|
init | () | method |
public static function init(publisherId:String):void
Initialize the AdMob interface. Call this once, before using any other methods.
Parameters
publisherId:String — your publisherId (check your AdMob account control panel for your App.)
|
refreshAd | () | method |
public static function refreshAd():void
Refresh the ad currently on display. Throws an error if no ad is currently active.
Error — if AdMob.init has not been called
| |
Error — if there is no current ad to refresh
|
removeEventListener | () | method |
public static function removeEventListener(type:String, listener:Function, useCapture:Boolean = false):void
Removes a listener from the EventDispatcher object. If there is no matching listener registered with the EventDispatcher object, a call to this method has no effect.
Parameters
type:String — event type (AdMobEvent or AdMobErrorEvent)
| |
listener:Function — The listener function that processes the event.
| |
useCapture:Boolean (default = false ) — Determines whether the listener works in the capture phase or the target and bubbling phases.
|
Error — if AdMob.init has not been called
|
See also
setVisibility | () | method |
public static function setVisibility(visible:Boolean):void
Sets the visibility of the current ad. It may be useful to hide and show an ad instead of destroying and reloading.
Parameters
visible:Boolean — true or false - whether the ad is visible or not.
|
Error — Thrown if AdMob.init has not yet been called first
| |
Error — Thrown if there is no activeAd to show or hide.
|
showAd | () | method |
public static function showAd(type:String, horizontalAlign:String, verticalAlign:String, testDevices:Vector.<String> = null, offsetX:int = 0, offsetY:int = 0):void
Displays a new Ad
Parameters
type:String — ad format, of the type AdMobAdType.BANNER,AdMobAdType.IAB_BANNER,AdMobAdType.IAB_LEADERBOARD, or AdMobAdType.IAB_MRECT. See AdMob documentation for more information.
| |
horizontalAlign:String — horizontal alignment of the ad of the type AdMobAlignment.LEFT,AdMobAlignment.RIGHT, or AdMobAlignment.CENTER
| |
verticalAlign:String — vertical alignment of the ad of the type AdMobAlignment.TOP,AdMobAlignment.BOTTOM,AdMobAlignment.CENTER
| |
testDevices:Vector.<String> (default = null ) — (optional) Vector of device test IDs, if running test ads on device. (For convenience, you can pass AdMob.getTestDeviceIDs() to this parameter- but remember to remove it before publishing your app.) Alternatively, to get your devices test id, run an application and view logcat (command 'android-sdk\platform-tools\adb logcat'). Your device test ID will be printed there. See Google's AdMob documentation for more details.
| |
offsetX:int (default = 0 ) — (optional) set an exact X pixel offset (for absolute positioning.) Note that this is relative to the actual screen height, not any fullscreen scaling; if your screen is scaled, you'll need to calculate the correct relative coordinates. for basic absolute positioning (traditional x, y from top left), use AdMobAlignment.TOP and AdMobAlignment.LEFT for horizontalAlign and verticalAlign respectively.
| |
offsetY:int (default = 0 ) — (optional) set an exact Y pixel offset (for absolute positioning.) Note that this is relative to the actual screen height, not any fullscreen scaling; if your screen is scaled, you'll need to calculate the correct relative coordinates. for basic absolute positioning (traditional x, y from top left), use AdMobAlignment.TOP and AdMobAlignment.LEFT for horizontalAlign and verticalAlign respectively.
|
Error — Thrown if AdMob.init has not yet been called first
| |
Error — if adFormat is not one of the valid types AdMobAdType.BANNER,AdMobAdType.IAB_BANNER,AdMobAdType.IAB_LEADERBOARD, or AdMobAdType.IAB_MRECT
| |
ArgumentError — if horizontalAlign is not one of the valid types AdMobAlignment.LEFT,AdMobAlignment.RIGHT, or AdMobAlignment.CENTER
| |
ArgumentError — if verticalAlign is not one of the valid types AdMobAlignment.TOP,AdMobAlignment.BOTTOM,AdMobAlignment.CENTER
|
See also
FAILED_TO_RECEIVE_AD | Event |
com.milkmangames.nativeextensions.android.events.AdMobErrorEvent
com.milkmangames.nativeextensions.android.events.AdMobErrorEvent.FAILED_TO_RECEIVE_AD
Dispatched when ad has failed to load after a call to showAd()
Dispatched when ad has failed to load after a call to showAd()LEAVE_APPLICATION | Event |
com.milkmangames.nativeextensions.android.events.AdMobEvent
com.milkmangames.nativeextensions.android.events.AdMobEvent.LEAVE_APPLICATION
Dispatched when a user action on an ad causes the focus to change elsewhere
Dispatched when a user action on an ad causes the focus to change elsewhereRECEIVED_AD | Event |
com.milkmangames.nativeextensions.android.events.AdMobEvent
com.milkmangames.nativeextensions.android.events.AdMobEvent.RECEIVED_AD
Dispatched when ad has successfully loaded following a call to AdMob.showAd()
Dispatched when ad has successfully loaded following a call to AdMob.showAd()SCREEN_DISMISSED | Event |
com.milkmangames.nativeextensions.android.events.AdMobEvent
com.milkmangames.nativeextensions.android.events.AdMobEvent.SCREEN_DISMISSED
Dispatched when a fullscreen interactive ad viewv is dismissed by the ad
Dispatched when a fullscreen interactive ad viewv is dismissed by the adSCREEN_PRESENTED | Event |
com.milkmangames.nativeextensions.android.events.AdMobEvent
com.milkmangames.nativeextensions.android.events.AdMobEvent.SCREEN_PRESENTED
Dispatched when a fullscreen interactive ad view is presented by an ad
Dispatched when a fullscreen interactive ad view is presented by an adVERSION | Constant |
public static const VERSION:String = 1.0.6
Current API Version