1 2 Previous Next 40 Replies Latest reply: Dec 25, 2011 9:31 AM by damian_pope RSS

    AIR for Android Captive Runtime

    As<3 Community Member

      Is it possible to package android apps with AIR (or will it be) using Flash CS5.5? I don't see anything on the web about. Just how to do it with Flex and ADT etc...

       

       

        • 1. Re: AIR for Android Captive Runtime
          mola2alex Community Member

          Agree, seems like there is support for Flex and Flash Builder but no love for the Flash CS5.5 I bought in May mainly for the "Mobile workflow".  I would also like to know how to use native extensions.

          • 2. Re: AIR for Android Captive Runtime
            monkey500 Community Member

            Are you saying you can't make Air apps for android through Flash 5.5 at all? Sorry, I don't know what captive runtime means..

            • 3. Re: AIR for Android Captive Runtime
              BaronKarza Community Member

              So, anyone has any hint for building the captive version by starting from a FLA in Flash Cs5.5?

              • 4. Re: AIR for Android Captive Runtime
                mola2alex Community Member

                @monkey500: iOS apps made with Air include the runtime as part of tha app.  Previous to Air 3.0, all android apps had a dependency in that all Android phones needed your app + the Adobe Air app to work.  With 3.0, it is now possible to bundle your app + the air runtime app in a single file or download so the user doesn't have to download the Air runtime to make it work.

                 

                I wish Adobe would be clear on the tools they make and when you should use one vs. the other.  I am starting to feel like the Flash Pro 5.5 I recently bought is not going to be updated to support these new capabilities (native code as another example).  If it is, they willlikely charge again.  If this is the case, I might as well just learn native development rather than trying to figure out all these other tools. 

                • 5. Re: AIR for Android Captive Runtime
                  monkey500 Community Member

                  Thanks alex,

                  I've also invested in CS5.5, but haven't tried my apps on Android yet.

                   

                  How are the results of Air 2.7 and Air 3 on android? Anyone tested it on a tablet?

                  • 6. Re: AIR for Android Captive Runtime
                    Colin Holgate CommunityMVP

                    AIR 2.7 works well on Android. I haven't yet tried the release AIR 3.0 on Android (I can't find the SDK download page), so I'm not sure how it does. Aside from having to set the bitdepth to 16 bit to get the best performance, other people seem to have done ok with it. Some of the Android apps Adobe showed at the keynote speech were done with AIR 3.0.

                    • 7. Re: AIR for Android Captive Runtime
                      monkey500 Community Member

                      Thanks Colin, perhaps best then not to rush into the new versions before they're bug free..

                      • 8. Re: AIR for Android Captive Runtime
                        DachFlach Community Member

                        I am using 3.0 and am experiencing only Good Things on Android Tablet.

                        I first used the Candidate Release and now the full version.

                        I am not using Captive Runtime as Android has AIR 3.0 public.

                        • 10. Re: AIR for Android Captive Runtime
                          mola2alex Community Member

                          It would be nice to have the option for captive runtime since some people don't like the dependency and have no idea what Air is.  They may just uninstall your app thinking it is malicious because it will try to download something else when you launch your app (if they dont have it).  It would be sweeter if Google just bundled it in and updated it in the background like they do the market app.  The captive runtime is 1 aspect but really want to take advantage of native code like 'share' and 'toasts' for example.

                          • 11. Re: AIR for Android Captive Runtime
                            DachFlach Community Member

                            You can use toasts, contacts, etc already using this technique:
                            http://www.jamesward.com/2011/05/11/extending-air-for-android/?replytocom=163323

                            • 12. Re: AIR for Android Captive Runtime
                              mola2alex Community Member

                              I have seen that but was hoping for something easier like adding an extension and then a simple AS3 call. 

                              • 13. Re: AIR for Android Captive Runtime
                                Joe ... Ward CommunityMVP

                                It can take the authoring tools (Flash Pro CS and Flash Builder) a cycle to catch up to new features in the runtime. I would expect full support for captive runtimes and native extensions in the next release of these products.

                                 

                                In the meantime, you can build your app in Flash Pro CS (for example), and do the final packaging step using the ADT utility from the AIR 3 SDK. Inconvientent, yes; but it can be done.

                                • 14. Re: AIR for Android Captive Runtime
                                  BaronKarza Community Member

                                  Yes this is exactly what I have in mind but I would be happy to see (for example) what is the complete adt command that Flash Pro calls in order to build the apk.

                                  So I can copy/paste it and all I have to do is to add that parameter to activate the "captive mode".

                                  Any hint?

                                  • 15. Re: AIR for Android Captive Runtime
                                    Colin Holgate CommunityMVP

                                    One difference between Flash Pro and Flash Builder, if I understood the keynote speech correctly, is that the FB team already have a public beta posted that will allow the captive runtime. Will Flash Pro users have to wait perhaps a year before being able to not use ADT?

                                    • 16. Re: AIR for Android Captive Runtime
                                      As<3 Community Member

                                      Awww fair enough. Thanks for the replies.

                                      • 17. Re: AIR for Android Captive Runtime
                                        Joe ... Ward CommunityMVP

                                        So for a normal release-type apk you would use:

                                        adt     -package

                                            -target apk

                                            -storetype pkcs12 -keystore ../myCert.p12

                                            myApp.apk

                                            myApp-app.xml

                                            myApp.swf icons

                                         

                                        (All on one line, replacing the myXXX with the appropriate values for your app)

                                         

                                        For a captive runtime apk, you would use (the target is the only difference):

                                         

                                        adt     -package

                                            -target apk-captive-runtime

                                            -storetype pkcs12 -keystore ../myCert.p12

                                            myApp.apk

                                            myApp-app.xml

                                            myApp.swf icons

                                        • 18. Re: AIR for Android Captive Runtime
                                          mola2alex Community Member

                                          Is there a way to run the command line in flash pro?  Or link to step by step?

                                          • 19. Re: AIR for Android Captive Runtime
                                            Joe ... Ward CommunityMVP

                                            No, there's no command line interface within Flash Pro. Possibly you could script it with the Flash scripting interface, jsapi. (I've never done anything of the sort, so I'm not sure.)

                                             

                                            The step-by-step is:

                                            1. Get the AIR 3 SDK.

                                            2. Create the app. At this point you should have a folder with the SWF, app descriptor, resources

                                            3. Find your code signing cert.

                                            4. Open a command/terminal window

                                            5. change directories (cd) to the app folder

                                            6. Run ADT (from the bin folder of your AIR SDK) with the options shown above

                                            • 20. Re: AIR for Android Captive Runtime
                                              BaronKarza Community Member

                                              Thanks Joe Ward,

                                              I appreciated very much your suggestions.

                                              One more question: what if I have two subdirectories with assets, for example assets0 and assets1?

                                               

                                              adt     -package

                                                  -target apk

                                                  -storetype pkcs12 -keystore ../myCert.p12

                                                  myApp.apk

                                                  myApp-app.xml

                                                  myApp.swf icons

                                                  assets0

                                                  assets1

                                               

                                              Is this correct?

                                              Thanks in advance

                                              • 21. Re: AIR for Android Captive Runtime
                                                Joe ... Ward CommunityMVP

                                                Yes. If you list a file it is included. If you list a directory, that directory and all its contents are included in the package. (For example, "icons" in the example is a folder containing icon files.)

                                                 

                                                For the gory details on the command line options, see http://help.adobe.com/en_US/air/build/WS901d38e593cd1bac1e63e3d12994b39ff0-8000.html

                                                 

                                                (Except it seems, the -apk-captive-runtime option, which I'm working to get updated ASAP!)

                                                • 22. Re: AIR for Android Captive Runtime
                                                  BaronKarza Community Member

                                                  Thanks Obi-Ward Kenobi, you are my only hope.

                                                  *bows*

                                                  • 23. Re: AIR for Android Captive Runtime
                                                    Colin Holgate CommunityMVP

                                                    This part "1. Get the AIR 3 SDK.", is proving to be a challenge. I have AIR 3.0 installed, and FP11, but I can't find a download link for the release SDK.The download button at the right of this page:

                                                     

                                                     

                                                    http://www.adobe.com/products/air.html

                                                     

                                                    doesn't seem to do anything.

                                                    • 24. Re: AIR for Android Captive Runtime
                                                      BaronKarza Community Member

                                                      Hi Colin,

                                                      In that page you posted, on the menu on the right, you should see a "downloads" box

                                                      Click on the second entry (that is Android Air Sdk) and you should be redirect to the download page.

                                                      • 25. Re: AIR for Android Captive Runtime
                                                        Joe ... Ward CommunityMVP

                                                        The direct link to the sdk download page is http://www.adobe.com/special/products/air/sdk/

                                                         

                                                        The direct link to the AIR 3 runtime is http://get.adobe.com/air/

                                                         

                                                        [Edit: the links on the AIR product page appear to work now.]

                                                        • 26. Re: AIR for Android Captive Runtime
                                                          Colin Holgate CommunityMVP

                                                          Baron, the button you pointed to is the one I said that doesn't do anything.

                                                           

                                                          Joe, thanks for the direct link.

                                                          • 27. Re: AIR for Android Captive Runtime
                                                            mola2alex Community Member

                                                            @Joe...Ward: Do you know when Flash Pro will support all the new features of AIR3 or at least can you confirm it is in the plan?

                                                            • 28. Re: AIR for Android Captive Runtime
                                                              Joe ... Ward CommunityMVP

                                                              Sorry, I can't comment on future release plans.

                                                              • 29. Re: AIR for Android Captive Runtime
                                                                mola2alex Community Member

                                                                It was worth a try.

                                                                • 30. Re: AIR for Android Captive Runtime
                                                                  mola2alex Community Member

                                                                  I sat down last night and took some time to try to figure this out.  I was successful in taking my swf and getting a working captive android app.  I was also able to get the native extensions working as well (vibrate on button press).  It adds a lot of extra steps to the process but it is possible.  One of the issues is testing, especially the native extensions.  You have to create the swf and manually package it, then manually get it on your phone and install it (maybe there is an install feature in ADT but I haven't got that far, either way, still not as easy as clicking publish).  It is ok if you want to build a captive app once you get your app finalized but without being able to quickly test the native extensions quickly from within Flash Pros publish, I will likely hold off on using native extensions until flash pro is updated or I really need it.

                                                                   

                                                                  Now some results.

                                                                   

                                                                  Captive app added about 8MB to my apk file size which is pretty consistent with what others have experienced on here as well.  If you push a lot of updates, you may get a lot of angry users depending on data plan.  Now, once you look at your app within Android file manager, it takes up over 25MB of space but approx 200k if you move it to SD (this is Gingerbread size, Froyo can differ in how much can be moved to SD).  This is consistent with the new AIR in the market that is about 8MB file size but expands to 25MB once installed.  This is about 9MB increase over AIR2.7 which weighed in around 16MB (expanded) I believe.  Moving apps to SD will help some of the older phones with the file size but if they have 10 AIR apps, it could add up. 

                                                                   

                                                                  I am debating whether or not I should use the captive feature or not.  Considering I can setup my android manifest to prefer SD card install, it might be worth it.  I also did notice that some of my currently published apps had some strange behaviour with the new AIR3 runtime and I had to update them quickly, yet another reason you may want to use captive apps.

                                                                   

                                                                  Good luck

                                                                  • 31. Re: AIR for Android Captive Runtime
                                                                    DachFlach Community Member

                                                                    While I do not currently want to use CaptiveRuntime, I am wondering if it is easily added to an app that is being published with Eclipse?

                                                                     

                                                                    I use Eclipse to easily test my apps with on my devices.

                                                                    I publish my SWF in Flash Pro and move the swf to my Eclipse package and run it immediately on my device.

                                                                    • 32. Re: AIR for Android Captive Runtime
                                                                      BaronKarza Community Member

                                                                      I'm still a bit confused.

                                                                      I have to admit that I have still to try because lately I have not so much spare time.

                                                                      I know now how to create captive apps.

                                                                       

                                                                      What I do not know is how to use native extensions in Flash CS5.5

                                                                       

                                                                      For example I downloaded the example "vibration.zip" from here

                                                                      http://www.adobe.com/devnet/air/native-extensions-for-air/extensions/vibration.html

                                                                      I got the swc and put it in flash library as I usually do when I use swc.

                                                                      Then I add the code to my project in order to make my phone vibrate (and I added also the permission entry).

                                                                      I compiled the whole thing and got no errors.

                                                                      But when I try it in runtime I get a lot of errors coming from the swc

                                                                       

                                                                      Obviously I think I will have to do it manually with ADT.

                                                                      This means that I can test it only on my device and I have to put some sort of "if" in my code for excluding that code when I compile and launch it from Flash env.

                                                                      Am I Right?

                                                                      If yes, can someone drop some lines in order to add an extension when packaging with ADT?

                                                                      Thanks in advance

                                                                      • 33. Re: AIR for Android Captive Runtime
                                                                        mola2alex Community Member

                                                                        You need to use command line ADT to compile. You also need to add -extdir "foldername"to the command line that has your android native code in it.  In addition, you need to modify your XML file to include <extensions>.  I just took the sample at the below link and looked at how they structered theri XMLs etc.  I also got the toasts working.

                                                                         

                                                                        http://www.smallscreendesign.com/2011/09/29/air-native-extensions-rock/

                                                                         

                                                                        One issue I ran into with AIR3 is that the soft menu key on Android tablets is missing.  Apps I compiled in AIR2.6 SDK such as the sample "Options Menu" in the template show the menu key in Honeycomb.  Same app compiled using AIR3 does not.  Now I have users emailing me that are unable to get into the options of my apps and I have to ugly up the UI with a button.  If you need this feature, please vote below:

                                                                         

                                                                        https://bugbase.adobe.com/index.cfm?event=bug&id=2936827

                                                                        • 34. Re: AIR for Android Captive Runtime
                                                                          Joe ... Ward CommunityMVP

                                                                          To include a native extension in the package, add "-extdir dir-with-ane-files" to the command line after the application descriptor. E.g:

                                                                          adt     -package

                                                                              -target apk

                                                                              -storetype pkcs12 -keystore ../codesign.p12

                                                                              myApp.apk

                                                                              myApp-app.xml

                                                                            -extdir extensionsDir

                                                                              myApp.swf icons

                                                                           

                                                                          More details here: http://help.adobe.com/en_US/air/build/WS901d38e593cd1bac-4f1413de12cd45ccc23-8000.html

                                                                           

                                                                          Testing is a little more problematic until Flash CS supports native extensions. There are ways to do it on the desktop using the command-line ADL utility, but really, I think testing on the device is the easiest. (I do have to admit that I haven't used Flash CS to work with ANEs, only Flash Builder at this point.)

                                                                          • 35. Re: AIR for Android Captive Runtime
                                                                            mola2alex Community Member

                                                                            @Joe...Ward:  A bit off topic but I can't seem to find out anything about the below.  I am wondering itf it is also an issue in Flash Builder.

                                                                             

                                                                            http://forums.adobe.com/thread/910973?tstart=0

                                                                            • 36. Re: AIR for Android Captive Runtime
                                                                              BaronKarza Community Member

                                                                              Guys,

                                                                              At last I found some time and managed to test both the captive package and the native extentensions.

                                                                              All went well.

                                                                              Now I have done "from scratch" an application that has the captive runtime and that vibrates the phone.

                                                                              Thanks to everyone.

                                                                               

                                                                              P.S. Obviosly now I'm wating for a native extension "officially" supported  for displaying Admob banners in my app and I'm done :-)

                                                                              • 37. Re: AIR for Android Captive Runtime
                                                                                BaronKarza Community Member

                                                                                Hi,

                                                                                I've made a complete working example for publishing an application with captive runtime, assets and native extensions starting from Flash CS5.5

                                                                                I was able to make it thanks to hints and suggestions I found in this thread.

                                                                                   

                                                                                Note: english is not my native tongue so I hope you understand what I've written also if sometime it sounds "engrish".

                                                                                 

                                                                                Here it is the link to the zip file:

                                                                                    http://www.genereavventura.com/hosted/Air3NativeExtensions/AirVibrate.zip

                                                                                 

                                                                                Requirements:

                                                                                - You must have Flash cs5.5 pro (obviously)

                                                                                - You must have installed the overlay for Air3.0 sdk on your Flash cs5.5 pro

                                                                                Here it is a link that explain how to accomplish it: http://forums.adobe.com/message/3939712

                                                                                 

                                                                                Here the steps I made.

                                                                                 

                                                                                1) Open Flash CS5.5 and create a new AIR for Android application

                                                                                 

                                                                                2) Add the swc to the libraries used by your FLA (open Actionscript 3.0 settings and add "VibrationActionScriptLibrary.swc")

                                                                                   Btw, you can find this "ready to use" native extension inside the zipfile that you can download from here: http://www.adobe.com/devnet/air/native-extensions-for-air/extensions/vibration.html

                                                                                   However in my example you will find also a directory named "extension" that contains it.

                                                                                 

                                                                                3) Open and then close the "air for android settings": by doing this Flash will create yourapp-app.xml file in the directory where your FLA resides.

                                                                                   For example my fla is named "vibrate.fla" so Flash created for me a "vibrate-app.xml" file.

                                                                                 

                                                                                4) Make a copy of this "vibrate-app.xml" file by naming it "real-vibrate-app.xml" (or choose whatever name you want)

                                                                                   I've done this because after modyfing the original one by adding the <extension> tag (see below) I wasn't able to test my app from within Flash IDE (when I compile it it simply doesn't start)

                                                                                   Instead by doing this all worked fine.

                                                                                 

                                                                                5) Edit the "real-vibrate-app.xml" file by adding somewhere these lines (I added it just before the <initialWindow> tag)

                                                                                    <extensions>

                                                                                      <extensionID>com.adobe.Vibration</extensionID>

                                                                                    </extensions>

                                                                                 

                                                                                6) Add <uses-permission android:name="android.permission.VIBRATE"/> in the <android> <manifestAdditions> part in "real-vibrate-app.xml" file.

                                                                                   You should do something like this:

                                                                                   <android>

                                                                                      <manifestAdditions>

                                                                                        <![CDATA[<manifest>

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

                                                                                        </manifest>]]>

                                                                                      </manifestAdditions>

                                                                                   </android>

                                                                                 

                                                                                7) Develop your application

                                                                                   I made a simple one that loads an external jpg and shows it on the stage: then the user can tap on it to make the phone vibrate.

                                                                                   The function "doVibration" is called only when the app is running on Android Device so I do not get any executions error when I run the app from within Flash Ide

                                                                                 

                                                                                8) Publish and test it to your USB connected device by launching the "publish.bat" file I have created

                                                                                   Open a dos prompt and move to your project directory then type publish.bat and press enter.

                                                                                 

                                                                                   Note: it can be that you have to edit the bat file in order to change the path to the ADT tool that comes with Air3.0 sdk

                                                                                   It should be in [your adobe flash cs5.5 directory]\AIR2.6\bin\adt (rememeber, you must have installed the Air3.0 sdk overlying the old Air2.6/2.7 in the AIR2.6 directory)

                                                                                 

                                                                                   Inside the bat file you can change easily the target type (captive or not) simply by commenting/decommenting the right line.

                                                                                   Captive version is about 8Mb more than the normal one but the big deal is that the user that installs it do not need the air runtime installed on his phone!

                                                                                 

                                                                                   The "big line" that creates the package is the following one:

                                                                                 

                                                                                   call %ADT_LINK% -package -target %TARGET_TYPE% -storetype pkcs12 -keystore certificate/vibrate.p12 -storepass android AirVibrate.apk real-vibrate-app.xml -extdir extensions vibrate.swf icons assets

                                                                                 

                                                                                   where:

                                                                                 

                                                                                   call %ADT_LINK%          it's just the path to the ADT tool

                                                                                   -package                 it's the command that we want ADT to execute

                                                                                   -target %TARGET_TYPE%    captive/non captive version

                                                                                   -storetype pkcs12        certificate related

                                                                                   -keystore certificate/vibrate.p12  path to your self signed certificate

                                                                                   -storepass android       certificate related, I created the example certificate with "android" password and this parameters tell ADT to always use it without prompting

                                                                                   AirVibrate.apk           the name of the Apk

                                                                                   real-vibrate-app.xml     the apk-xml to use that is the one we modified manually above

                                                                                   -extdir extensions       it's the path to the directory that contains the native extension

                                                                                   vibrate.swf              the main swf

                                                                                   icons                    the icons directory

                                                                                   assets                   the assets directory (where I put the external jpg)

                                                                                 

                                                                                 

                                                                                That's all.

                                                                                If everything is correct, the batch file creates the AirVibrate.apk then installs it on your attached usb device and run it.

                                                                                When you tap over the Android image that will appear, your phone should vibrate.

                                                                                 

                                                                                Now.. does someone wants to develop a Native Extension to show Admob banners in our Android Air Applications?

                                                                                 

                                                                                If I missed something, please let me know.

                                                                                Thanks

                                                                                • 38. Re: AIR for Android Captive Runtime
                                                                                  Colin Holgate CommunityMVP

                                                                                  Thank you for that.

                                                                                   

                                                                                  Here's another useful resource, Brent's iBrent YouTube channel:

                                                                                   

                                                                                  http://www.youtube.com/user/iBrent

                                                                                   

                                                                                  He has posted a few new ones today, that include things like how to overlay AIR3.0 onto CS5.5, and how to compile an app that has native extensions.

                                                                                  • 39. Re: AIR for Android Captive Runtime
                                                                                    mola2alex Community Member

                                                                                    I have vibration and toasts working in my apps.  Agree that admob would be a great addition.  Another good one (if possible) would be a native listview control.  I cannot seem to find a good one made in flash that will allow me as good of a user experience as stock android.

                                                                                    1 2 Previous Next