Friday, 19 January 2018

Admob Adobe ANE Extension

For support, contact support@ibrahiminfotekz.com

Before you begin:

The AdMob Extension requires Adobe AIR 20.0 or higher. You can download the latest
version of AIR at http://www.adobe.com/devnet/air/air-sdk-download.html.

Procedure:

Step 1: Install the latest version adobe AIR SDK in your IDE Adobe Flash Professional CC

Enabling the AIR 20.0 or later SDK in Adobe Flash Professional CC

  • Unzip the AIR 20.0 or later SDK package to a location on your hard drive.
  • Launch Flash Professional.
  • Select Help > Manage AIR SDK...
  • Press the Plus (+) Button and navigate to the location of the unzipped AIR SDK
  • Press OK
  • Select File > Publish Settings
  • Select the latest AIR SDK for Android from the 'Target' Dropdown menu

Step 2: Include the AdMob and GoogleServices Extension Library

Add the AdMob ANE files to your project.

In Adobe Flash Professional CC:
  • Create a new mobile project
  • Choose File>Publish Settings...
  • Select the wrench icon next to 'Script' for 'ActionScript Settings'
  • Select the Library Path tab.
  • Click 'Browse for Native Extension (ANE) File' and select the com.milkmangames.extensions.AdMob.ane file.
  • Click 'Browse for Native Extension (ANE) File' and select the com.milkmangames.extensions.GoogleServices.ane file.
  • Press OK.
  • Select the wrench icon next to 'Target' for Player Settings
  • Select the 'Permissions' tab, and select 'INTERNET' and 'ACCESS_NETWORK_STATE'.
  • Check the 'Manually manage permissions and manifest additions for this app' box.
  • Press OK.
Step 3: Register Your App with AdMob
  • Visit http://www.admob.com and sign up, or login to your existing account.
  • From the Home page, Select “Add your First App”.


  • Choose “Add your app manually”, and give a name for your application. (Or, if it's alreadyon the app store, use 'Search for your app' to find it.
  • Select the platform (Android or iOS) for your application. If you are creating one AIR
  • application for both iOS and Android, follow the steps in this section through once for each platform.

Step 4: Update Your Application Descriptor

using the AIR 20.0 or higher SDK, include the extension in your Application
Descriptor XML, and update the Android Manifest Additions with some AdMob specific settings.
For a working example, see 'example/app.xml'.
1. Set your AIR SDK to 20.0 (or higher) in the app descriptor file:

<application xmlns="http://ns.adobe.com/air/application/20.0">

Include a link to the extension sin the descriptor:

<extensions>
<extensionID>com.milkmangames.extensions.AdMob</extensionID>
<extensionID>com.milkmangames.extensions.GoogleServices</extensionID>
</extensions>
For the AdMob for Android Extension Only: Update your Android Manifest Additionsyou'll
need to have the INTERNET, and ACCESS_NETWORK_STATE permissions; add a special Activity for AdMob, and set the <uses-sdk> flag. The line shown
in green below should appear on a single line in your XML file. There should be
no spaces or carriage return inside keyboard|keyboardHidden|orientation|
screenLayout|uiMode|screenSize|smallestScreenSize .
<android>
<manifestAdditions><![CDATA[
<manifest android:installLocation="auto">
<uses-sdk android:minSdkVersion="9" android:targetSdkVersion="19" />
<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
<application>
<!-- this meta-data tag is required for AdMob -->
<meta-data android:name="com.google.android.gms.version" android:value="8487000"/>
<!-- this activity is required for AdMob -->
<activity android:name="com.google.android.gms.ads.AdActivity"
android:configChanges="keyboard|keyboardHidden|orientation|screenLayout|uiMode|
screenSize|smallestScreenSize"
android:theme="@android:style/Theme.Translucent.NoTitleBar"/>
</application>
</manifest>]]>
</manifestAdditions>
</android>

Step 5: Add ActionScript Code.

Initialize the AdMob Extension

1. Import the API Classes:
import com.milkmangames.nativeextensions.*;
import com.milkmangames.nativeextensions.events.*;

2. Initialize the API with the Ad Unit ID for your main banner ad and retrieve your ad
unit ID(s) from the AdMob web site control panel, as described in the section above,
"Register Your App with AdMob."

To check that the current platform is supported by the extension before initializing (for instance, AdMob won't work on Windows):

if(AdMob.isSupported)
{
AdMob.init("YOUR_AD_UNIT_ID_HERE");
}
else
{
trace("AdMob won't work on this platform!");
return;
}

Showing Test Ads During Development

To avoid making ad impressions while testing, you can enable a list of test device IDs.
Be sure to REMOVE this method call before publishing your final application. (Otherwise,
your end users will see test ads too!)
// remove this line when you're done testing!
AdMob.enableTestDeviceIDs(AdMob.getCurrentTestDeviceIDs());
Create and Display a Banner Ad
Show your first ad. The following call displays an ad that will automatically fill the current
width of the screen, and remain top-center aligned:
AdMob.showAd(AdMobAdType.SMART_BANNER,AdMobAlignment.CENTER,AdMobAlignment.TOP);
Optional: Loading Interstitial Ads
Intesrtitial ads are a special, full screen ad type that can produce higher revenue for your
application than traditional banners.
To display an interstitial ad, call the loadInterstitial() function. The first parameter is the Ad Unit
ID for the interstitial (see “Register Your App With AdMob” above.)
// load interstitial, and show it when its ready
AdMob.loadInterstitial("your interstitial ad unit id", true);

The second parameter tells the extension to show the interstitial automatically as soon as it's
loaded.

Step 5: Build the Application

Adobe Flash Professional CC:

Flash CS6 has full support for native extensions.
1. Make sure you've included the ANE files as described in Section 2, 'Include the Library'.
2. Build your mobile application and deploy as usual.

We support through blog comments, Facebook, or Twitter. Please email
us and we'll be happy to help you out!

Admob Adobe ANE Extension

For support, contact support@ibrahiminfotekz.com Before you begin: The AdMob Extension requires Adobe AIR 20.0 or higher. You can...