Adobe Animate CC : How to integrate Admob Banner for Android

Adobe Animate CC : How to integrate Admob Banner for Android



Test on:
- Mac OS X : El Capitan
- Adobe Animate CC (Flash Pro)
- Asus Zenfone 4.5
- ANEAdMob

[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
https://github.com/pozirk/ANEAdMob

[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: "AnCCBannerAds.fla" then I just add text for test when app running on screen and create dynamic text then leave name as "res".



4. In "Publish" panel click an icon "pencil" then type name "Main" and leave button as "Flash Professional" and click ok.



5. An ActionScript was created as below.



6. Add line of code as below images step by step.


6.1 import library.


6.2 implement admob instance


6.3 add listener for admob instance


6.4 create function for any event listener.

7. Add last line of code for show banner, change "ca-app-pub-xxxx" to your admob banner id. After that press "command + s", and browse to folder of this project to save Main.as file. 


7.1 show banner

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


2. Add swc file by click on red-f icon and browse.. to ANEAdMob/air/AdMob/bin/AdMob.swc


2.1 Browse... to .swc file


2.2 result after set library path to .swc file

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


3.1 Browse... to .ane file


3.2 result after set library path to .ane file

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


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


1.1 Click create... to create certificate file.


1.2 Fill your information


1.3 Choose "save as" to where you want to save certificate file.


1.4 Success create new certificate file.

2. After saved p12 file, fill in "Password" field and check setting as below image.


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


4. When your app has success installed on device, you should see this notice.


5. Let's see on your android device and don't forget to turn on your internet connection, 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. This comment has been removed by the author.

    ReplyDelete
  2. Hello again I apologize , I am following this tutorial and when running the apk from phone I get this error in the text box and I do not charge the announcement:

    BANNER_SHOW_FAIL >> The meta - data tag in your app 's AndroidManifest.xml does not Have the right value . Expected but found 8487000 4323000. You must have the following declaration Within the element:
    "meta -data android: name = " com.google.android.gms.version " android : value = "@ integer / google_play_services_version"

    Any idea of this error ?

    Thank you very much

    ReplyDelete
    Replies
    1. That's value not need to change, try install and test my apk: http://sh.st/WxOQm if that's ok, then download my source code and test run on android: http://sh.st/WxOHm

      Delete
    2. Hi Porawee Raksasin,

      can you build ane file for air23.0 ? Thanks

      Delete
    3. You can grab latest ANE Admob from this. https://github.com/pozirk/ANEAdMob
      I guess he build with AIR 23.0

      Delete
    4. Hi Porawee Raksasin,

      I use Animate CC 2017 ( Air 23.0 for Android ), when running the apk from phone I get this error in the text box

      "BANNER_SHOW_FAIL >> The meta - data tag in your app 's AndroidManifest.xml does not Have the right value . Expected but found 8487000 4323000. You must have the following declaration Within the element:
      "meta -data android: name = " com.google.android.gms.version " android : value = "@ integer / google_play_services_version""


      but i can run this file (http://sh.st/WxOQm). that's ok

      Delete
    5. Hi Porawee Raksasin,

      When I use the ANE file at this Link (https://github.com/pozirk/ANEAdMob) , and i build with air 23.0 (Animate 2017), i see this error "BANNER_SHOW_FAIL >> The meta - data tag in your app 's AndroidManifest.xml does not Have the right value . Expected but found 8487000 4323000. You must have the following declaration Within the element:
      "meta -data android: name = " com.google.android.gms.version " android : value = "@ integer / google_play_services_version"" , pls help me.

      Delete
    6. You build this ane with air 3.6

      Delete
  3. Hello Raksasin, I am also facing same problem. android : Value what ever you given that is working for your app, but not in other build apps. Please can u tell how we get that android : value.

    Thank you very much.

    ReplyDelete
    Replies
    1. Hi Gandhi, the real problem is if you were using latest ANE from https://github.com/pozirk/ANEAdMob , it's not same version as i use to create tutorial, i'm using an old version not current version.

      value not need to change.
      try download my sample and use ane from this link ANEAdMob Build3.6 : http://sh.st/U5NlH, 4323000 are correct for this ANE.

      Delete
  4. Hello Raksasin,Is there any way to make this without Main.as? Because i work without classes!

    ReplyDelete
    Replies
    1. Yeah you can do that for short answer,
      1. follow as my sample but not create Main.as
      2. create new MovieClip and gave it's name for sample "AdsMC".
      3. double-click to open AdsMC and place below code on AdsMC timeline
      //Start-Script
      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, onEvent);
      _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 Ads ID: ca-app-pub-3940256099942544/6300978111

      //showing here
      _admob.show("ca-app-pub-3940256099942544/6300978111", AdParams.SIZE_SMART_BANNER, AdParams.HALIGN_CENTER, AdParams.VALIGN_BOTTOM);
      }

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

      Main();
      //End-Script

      4. drag AdsMC and release on stage the AdsMC will created new instance of AdsMC, Done!!
      5. follow other part until finished and test by yourself

      Delete
    2. This comment has been removed by the author.

      Delete
    3. Your code missing line import package AdEvent.

      Delete
    4. Thanks!!..I found it before and i tried to hide my stupid question, but after i removed it... you answered

      Delete
    5. It's not stupid question, it can be happen anytime. You help me remind an error message and solution together.
      Thank you.

      Delete
  5. I get this error when try to publish.. any ideas?

    https://s9.postimg.org/cgmmf3ai7/Capture.png

    ReplyDelete
    Replies
    1. Another thing, try to use default manifest.xml anything else?

      Delete
  6. Warning: AndroidManifest.xml already defines versionCode (in http://schemas.android.com/apk/res/android); using existing value in manifest.
    Warning: AndroidManifest.xml already defines versionName (in http://schemas.android.com/apk/res/android); using existing value in manifest.
    Warning: AndroidManifest.xml already defines minSdkVersion (in http://schemas.android.com/apk/res/android); using existing value in manifest.
    Warning: AndroidManifest.xml already defines targetSdkVersion (in http://schemas.android.com/apk/res/android); using existing value in manifest.

    ReplyDelete
    Replies
    1. If their android cause from last line in your capture image, about this
      configChanges="keyboard|keyboardHidden|orientation|screenLayout|uiMode|screenSize|smallestScreenSize"

      screenSize & smallestScreenSize attributes are not available in SDK 10. They are been introduced in API level 13.

      So did you try to remove screenSize & smallestScreenSize and use only configChanges="keyboard|keyboardHidden|orientation|screenLayout|uiMode"

      Delete
    2. This comment has been removed by the author.

      Delete
  7. I resetup to match your project settings using ANEAdMob Build3.6 and
    Animate CC with Air 20.0

    I try to build your source files but get this error..
    BANNER_SHOW_FAIL >> Internal error

    Question: Is this correct and how do you setup to test ads?

    //showing here
    // for banner
    _admob.show("ca-app-pub-3940256099942544/6300978111",

    ReplyDelete
    Replies
    1. Can you send your project to me?, i will check it all. Just upload some where as .zip file and send to my email address "zack2029@gmail.com"

      Delete
    2. I made small change... I used dummy banner code for test from https://firebase.google.com/docs/admob/android/quick-start

      After that it worked, then I re-edited to add my banner code and compiled..all is working fine now..

      Thanks for helping..very good tutorial! Do you have more tutorials on Animate CC?

      Delete
  8. BANNER_SHOW_FAIL Internal error
    Please tell me what the problem is related.

    ReplyDelete
  9. zack2029@gmail.com
    I took a photo to address

    ReplyDelete
    Replies
    1. Please downgrade to Adobe AIR SDK 19.0 or lower but minimum is 3.6 for compatible with my sample file and tutorial. If you cannot downgrade bcoz of Adobe Flash(Animate) CC is standard AIR version 20.0 or above, please follow from this link only https://github.com/pozirk/ANEAdMob
      Please remind latest google ads change to base on firebase then google ads dummy id may need update to firebase too.

      Delete
    2. ...does this tutorial still work with your latest air 27 at https://github.com/pozirk/ANEAdMob ....and will it work with air less than 27?

      Delete
  10. thank you very much
    working like a charm!!!

    ReplyDelete
  11. You saved my ass. Thank you so much dude...

    ReplyDelete
  12. Hi,
    I have added .swc and .ane and followed your steps for code and xml fore.
    I have created apk successfully, but ad is npt showing in my device.
    am using sdk version 29...pleasehep

    Steps followed:
    1. follow as my sample but not create Main.as
    2. create new MovieClip and gave it's name for sample "AdsMC".
    3. double-click to open AdsMC and place below code on AdsMC timeline
    //Start-Script
    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, onEvent);
    _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 Ads ID: ca-app-pub-3940256099942544/6300978111

    //showing here
    _admob.show("ca-app-pub-3940256099942544/6300978111", AdParams.SIZE_SMART_BANNER, AdParams.HALIGN_CENTER, AdParams.VALIGN_BOTTOM);
    }

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

    Main();
    //End-Script

    4. drag AdsMC and release on stage the AdsMC will created new instance of AdsMC, Done!!
    Thanks in advance

    ReplyDelete
  13. Thank you because you have been willing to share information with us. we will always appreciate all you have done here because I know you are very concerned with our. eggy game

    ReplyDelete
  14. Hello, is it possible to add admob short code from pozirk admob ane to first frame of stage setup without using main.as ? If so, can you explain?

    ReplyDelete
  15. I like your all post. You have done really good work. Thank you for the information you provide, it helped me a lot. You can Latest Software Crack Free Download With Activation Key, Serial Key & Keygen I hope to have many more entries or so from you. Download Crack Softwares Free Download
    full latest version 2022 blog.
    PreSonus Notion Crack
    CLA-76 Compressor Crack
    Ozone Imager Crack
    1Keyboard Crack
    4Front TruePianos Latest VST Crack
    Adobe AIR SDK Crack

    ReplyDelete

Post a Comment