Adobe Animate CC : How to integrate Admob Interstitial for Android ( Without Main.as file )

Adobe Animate CC : How to integrate Admob Interstitial for Android ( Without Main.as file )



Test on:
- Mac OS X : El Capitan
- Adobe Animate CC (Flash Pro)
- Asus Zenfone 4.5
- ANEAdMob Build3.6 : http://sh.st/U5NlH

[Sample Source code & Apk file]
Apk file: 
Source code: 

This topic not discuss about how to install any application, I just want to show you only apart of Adobe AIR - AdMob Integration for Android, If you want to see more on something else, please tell me at the end of this topic.

[Pre-Require]
download and install from any their instructions.
- Adobe Animate CC (Adobe AIR 20.0 for Android included)
http://www.adobe.com

- ANEAdMob
- Build3.6 : http://sh.st/U5NlH

[Create Adobe AIR Application]
1. Open Adobe Flash and choose "AIR for Android"

2. Then press "command + s", and browse to folder you want to save this project. 
sample: "AnCCAdsInterNoAS.fla"

3. On menu bar goto "Insert > New Symbol..." give their Name: "AdmobInterstitial" and leave Type: "Movie Clip", then click "OK".


4. Double-click AdmobInterstitial movieclip to open it then click on first keyframe, leave focus on that. Goto menu bar "Windows > Actions", an Action panel will open up then copy and paste this below code on it.

//-Start code

import com.pozirk.ads.admob.AdMob;
import com.pozirk.ads.admob.AdParams;
import com.pozirk.ads.admob.AdEvent;

var _admob:AdMob = new AdMob();

function Main() {
// constructor code
_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, onCacheOkEvent);
_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();

//Dummy Interstitial Ads ID: ca-app-pub-3940256099942544/6300978111

//caching here
_admob.cacheInterstitial("ca-app-pub-3940256099942544/1033173712");

}

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

function onCacheOkEvent(ae:AdEvent):void
{
//showing here
_admob.showInterstitial();
}

Main();

//-End Code

5. Open "Scene 1" then drag "AdmobInterstitial" movieclip in Library and release on stage.

[Add ANEAdMob]
1. Extract ANEAdMob.zip then in flash goto File > ActionScript Settings...

2. Add swc file by click add path [+] icon then click ane icon, after that browse.. to ANEAdMob/air/AdMob/bin/AdMob.swc

3. Add ane by click add path [+] icon then click ane icon, after that browse.. to ANEAdMob/AdMob.ane

4. Click ok, now you already to setting application for publish.

[AIR Android Settings]
1. In flash goto File > AIR XX.X.X for Android Settings...

2. On General tab check any value as below. don't forget App ID not allow underscore (_) in name just remove it, Version label only for test you can leave it blank. You should see AdMob.ane in Included files.

3. Just skip Deployment and goto tab "Icons" add at least one icon size, i created simple icon rectangle size 72x72 pixels for test.

4. Goto tab "Permissions" and check on "Manually manage permissions...descriptor file.". Make sure ACCESS_NETWORK_STATE and ACCESS_WIFI_STATE was checked.

[Config Application-app.xml]
Open your "filename-app.xml" and paste this code after end of "</icon>" as below images and saved overwrite this files.

<android>
     <manifestAdditions><![CDATA[<manifest>
           <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>
      </manifest>]]></manifestAdditions>
</android>

and

<extensions>
        <extensionID>com.pozirk.ads.AdMob</extensionID>
</extensions>

Sample image:


[Publish to Android Device]
1. Goto tab "Deployment" and click "create" if you don't have filename.p12 file, fill any text field with your data, i'm just input sample data then click "Save as" to your project folder.

2. After saved p12 file, fill in "Password" field and check setting as below.
Android deployment type
[/] Device release
AIR runtime
[/] Embed AIR runtime with application
After publishing
[/] Install application on selected Android devices
      [/] Launch application on selected Android devices
            [/] Device Serial No. {Your Device ID}

3. Connect your android device via usb cable and click "Publish"

4. When your app has success installed on device, you should see "The APK was packaged successfully,  but a warning occurred".

5. Let's see on your android device and don't forget to turn on your internet connection 3G, 4G or WIFI, AdMob banner was shows up on bottom of screen.


[Sample Source code & Apk file]
Apk file: 
Source code: 

It's work!! ;)
----------------------------->>
Learn more about ANEAdMob: https://github.com/pozirk/ANEAdMob

Comments

  1. Thanks for the share! Love reading your blog! Keep up the posts!
    Kim

    ReplyDelete
  2. Hey thanks for your tuto!!
    I have a request, I want to show Interstitial ads 5 times with time of 3 minutes between every ads using "Timer".
    can you please tell me, how can I do this?

    ReplyDelete

Post a Comment