Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
Locked
0

AIR for Android Captive Runtime

Guest
Oct 04, 2011 Oct 04, 2011

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

TOPICS
Development
19.2K
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Mentor ,
Oct 05, 2011 Oct 05, 2011

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

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Contributor ,
Oct 05, 2011 Oct 05, 2011

It was worth a try.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Contributor ,
Oct 06, 2011 Oct 06, 2011

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

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guest
Oct 07, 2011 Oct 07, 2011

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

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Contributor ,
Oct 07, 2011 Oct 07, 2011

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

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Mentor ,
Oct 07, 2011 Oct 07, 2011

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

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Contributor ,
Oct 07, 2011 Oct 07, 2011

@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

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Oct 05, 2011 Oct 05, 2011

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

Joe, thanks for the direct link.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Oct 05, 2011 Oct 05, 2011

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?

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guest
Oct 05, 2011 Oct 05, 2011

Awww fair enough. Thanks for the replies.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Oct 06, 2011 Oct 06, 2011

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.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guest
Oct 09, 2011 Oct 09, 2011

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 🙂

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guest
Oct 09, 2011 Oct 09, 2011

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

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Oct 09, 2011 Oct 09, 2011

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.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Contributor ,
Oct 11, 2011 Oct 11, 2011

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.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Dec 25, 2011 Dec 25, 2011
LATEST

Thank you so much for this BaronKarza! I just got it to work on my Xoom Android tablet. Before reading your post, I'd been searching for good instructions for AIR with Captive Runtime using Flash Pro but couldn't find anything. Your step-by-step guide was exatly what I was after. It took me a couple of tries but I just got it to work. For the first time, I was able to install my app on an Android tablet without requiring the user to install AIR seperately. Awesome! Thanks again.

Damian

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines