AIR Native Extensions rock!

We’re excited to attend Adobe MAX 2011 in Los Angeles and to showcase Cassandra Stand with the optimizations and new features we have introduced targeting latest Sony tablets for the Adobe AIR App Challenge. The new AIR 3.0 adds a lot of amazing features and, among them, AIR Native Extensions simply rock! You can easily and fully integrate your AIR apps with underlying os, adding new features not provided by default in the SDK.

AndroidExtensions demo screenshot

We spent last couple of days creating a set of simple projects to let anyone get started with AIR Native Extensions on Android. Currently you can visit our github repository located at:

https://github.com/mr-archano/Android-AIR-Extensions
Actually you can find three simple-but-useful little extensions, which allow to use Android native facilities for:

  • sharing content
  • send SMS
  • show a Toast message

All you have to do in order to see them in action is to grab the AndroidExtensions_Demo Flex Mobile Project, follow the build instructions provided in README.textile and… enjoy!

Note: Below you can find the APKs of the demo application:

  • AEDemo.apk (1,4MB): requires AIR 3.0 RC for Android runtime installed on your device.
  • AEDemo_captive.apk (10.1MB): includes AIR 3.0 RC for Android runtime.

If you want to learn more about AIR Native Extensions check this page of Adobe Developer Connection:
http://www.adobe.com/devnet/air/native-extensions-for-air.html
You can find an exhaustive set of tutorials, technical articles and a list of ready-made NE, including this project.

33 Responses to “AIR Native Extensions rock!”

  1. Joseph says:

    Supper :) Thaannks

  2. [...] In the last days we work with new cool Adobe AIR native extensions. If you use Adobe Flash Platform to create your Android mobile applications read our articles on: http://www.smallscreendesign.com/2011/09/29/air-native-extensions-rock/ [...]

  3. Matt says:

    Can the share be used with pictures? If so, any examples?

    • toto says:

      Actual version of the share extension supports only text/plain MIME (including links). BTW the basecode can be easily extended in order to add the image sharing feature.
      Supposing that you have the path of the image to be shared (taken in your AIR/Flex application somehow), all you need is to provide that path to Android-side of extension, and set the extra of the sharing intent accordingly (take a look here http://stackoverflow.com/questions/3553017/android-share-via-dialog).
      In addition some change must be introduced in AS-side of ANE, changing
      the signature of the current share function, or maybe adding a new specific function for that.
      I hope my answer is clear enough :)
      I think this is a simple and useful feature, and I will add it into the next update.

      • Matt says:

        Thanks, that would be great! Basically in my app I do a screen grab and right now save it to the camera roll but it would be nice to share it right from the app.

        Another question is how can I make use of these extensions within Flash Pro? Hope that there is an easy way, I haven’t made the leap to Flex just yet and the app I built is currently all in Flash Pro CS5.5. Native extensions (share & toast) and ability to make captive app would be sweet but I can’t seem to find info on how to do this.

        Cheers

        • toto says:

          Hi Matt! Yes, like stated before, if you have the path of the image it would be easy to share it via Android native facilities.

          Unfortunately I have no clue about using ANE in Flash Pro, so I can’t give you any advice about that :( BTW now that ANEs are officially out, I guess someone will come out with a tutorial or an official announce in the next days…

          For now, you can try asking stackoverflow.com gurus or Adobe user forums. Consider to switch your workflow using Flash Builder too: it’s very straightforward and there is plenty of resources and tutorials about that ;)

          • Sander says:

            Hi,

            I created a video tutorial illustrating the proces in Flash Professional. It combines the process of overlaying the AIR3 SDK, creating a project using gyroscope native extension and compiling with ADT, installing the app on my iPad using Xcode Organizer. Hope this helps somebody!

            http://www.sworl.be/air-native-extensions-in-flash/

            My blog has all the links to downloads and help pages parameters.

  4. mikeciz says:

    Nice work on the ANE!

    In addition to images, could it be used to send to email/dropbox etc. ANY type of file passed into it? That would be awesome. I currently have to use a remote server to create the e-mail with attachement. This would eliminate that need entirely.

    Keep up the good work!

  5. djheru says:

    Any plans to make extensions to allow access to the contacts list?

    • toto says:

      The current feature set provided by this project will not be extended soon. But giving the user the access to own contact list will be an awesome extension for sure :)

  6. Anthony says:

    Hi,
    I have just release a blog post about creating a NativeAlert extension for AIR. It includes multiple buttons and dispatches ActionScript events when the user selects one of those buttons.
    the post can be found here.
    http://www.liquid-photo.com/2011/10/28/native-extension-for-adobe-air-and-ios-101/
    The source is on github and you can download the NativeAlert.ane file directly also

    Hope you guys like it.

  7. [...] got pointers in (mostly) the right direction from here, here and here. But I was still struggling with how to use FlashDevelop to get the compilation of java [...]

  8. Great Posts…

    [...] Every now and then we choose webpages that we read. Listed below are the latest websites that we choose [...]……

  9. Martin says:

    Hi, great work here. I’m actually looking for an ANE to connect to the music library on Android. Any experience? Thx.

  10. leo says:

    Hi Martin!

    Could you please DM us to info (AT) smallscreendesign.com?
    We can carry on the discussion privately.

    Thanks,
    Leo

  11. Gopinath says:

    Toto, Nice Work on ANE. I have one problem with this sample. When I compile ane by using build_ane target as dependency for build_apk, the sample does not work on 64-bit windows 7 machine. If I use the library which is shipped with your source, it works.

    Please help me out. I am struck.

  12. Akhil says:

    I also faced issues that ANE file build on my machine(Windows-7) was not working
    Solution:
    In build.xml Replace

    with

    It worked for me :)

  13. Akhil says:

    I also faced issues that ANE file build on my machine(Windows-7) was not working
    Solution:
    In build.xml Replace
    basedir=”${ANDROID_DIR}/bin”
    with
    basedir=”${ANDROID_DIR}/bin/classes”
    It worked for me :)

  14. Mac Adobe says:

    Pretty great post. I simply stumbled upon your weblog and wanted to say that I have truly enjoyed browsing your blog posts. After all I’ll be subscribing on your rss feed and I am hoping you write again soon!

  15. VivD says:

    I downloaded the apk but when I run it on mobile I don’t see the share image option. Is there a newer version of the apk present that has the share image sample?

    • toto says:

      Hi VivD. Unfortunately there’s no updated apk with this feature, but you can use last sources on github (https://github.com/mr-archano/Android-AIR-Extensions) and build your own apk.

      • VivD says:

        Thanks for your response. I downloaded the code and imported the project folder (AndroidExtensions_Demo) in Flash Builder 4.6, changed the air version to 3.1, changed the flex compiler to 4.6 as that is what I’m using and ran it on the device.

        However, when I clicked on Share Text button, I got the error below.
        TypeError: Error #1009: Cannot access a property or method of a null object reference.
        at com.ssd.ane::AndroidExtensions$/get context()[/Users/anto/git/Android-AIR-Extensions/AndroidExtensions/src/com/ssd/ane/AndroidExtensions.as:158]
        at com.ssd.ane::AndroidExtensions$/shareText()[/Users/anto/git/Android-AIR-Extensions/AndroidExtensions/src/com/ssd/ane/AndroidExtensions.as:48]

        Not sure why this is occurring. Are there any additional steps I should carry out for this to work?

  16. Matt says:

    I am using flash pro and able to get toast working but the shareimage doesn’t seem to work. I save an image to camera roll and then use the file path of the most recent image to throw into the shareImage. The path that comes back is correct but nothing happens. :(

    • Matt says:

      Just trying to get the simplest share example working by calling:

      AndroidExtensions.shareText(“My Subject”, “My Text”, “Share:”);

      Cannot seem to even get that working. The Toast is working and I have used that for a while now in the app so I know the ANE and component file are all in the right places. Is there any special permission I need to request?

      • toto says:

        Hi Matt, sorry for the delay (I missed the mail notification about your previous comment). The only permission you have to set is internet persmission.

        • Matt says:

          Thanks for the reply. I had that permission for another native admob extension. Still can’t seem to get the share function to work. Is there anything Flex specific that would hinder it from working in Flash? Calling Toast works like a champ but share doesn’t (text or image).

          I would be willing to pay for an extension that did image sharing and file sharing in Android.

          • toto says:

            Matt, there’s no Flex-specific stuff required by the ANE. Unfortunately I have no experience about ANE+Flash Pro.
            Do you get any error in the flash console? A sort of log could help…
            As a side note: do you use a device or the desktop emulator for tests?
            We could go private for further investigations: please drop an email at toto(at)smallscreendesign.com

  17. Matt says:

    Thanks for the offer but realized my mistake. Had the old ANE in the ADT compile directory (actually had both old and new). Deleting the old made it work.

Leave a Reply