10-25-2011 10:00 AM
There are many posts that all ask the same question about native extensions. I wanted to take the time to address all of the unanswered questions in one place.
Q. How do you create native extensions?
A. Currently today you can download the NDK 1.0 and create extensions that target Tablet OS 1.0.7 and AIR 2.7. A tutorial and samples from my BlackBerry DevCon talk are now on my blog. http://deleteaso.com/creating-air-native-extension
Q. Do I need AIR 3.0 to create and run native extensions?
A. No. Contrary to what Adobe says, AIR Native Extensions have been available on the PlayBook for some time. Developers needed the NDK in order to create them, which is now released. Native Extensions on all other platforms require AIR 3.0.
Q. Is Magnetometer and Gyroscope support included in the NDK 1.0?
A. No it is not. Support for these API's is only available in the upcoming beta release of NDK 2.0. In order for applications to take advantage of these, applications will need to run on Tablet OS 2.0 Beta, which is availalable today as a beta. Applications that use these API's will not work on Tablet OS 1.0.7 as the proper API's are not available.
Q. Do I need to use Flash Builder 4.6 to create ANE's?
A. No. You can develop the ActionScript implementation of your ANE in anything you like. Flash Builder does not have support for actually compiling an ANE file, you must use the command line for that. However, Flash Builder 4.6 has great support for developing applications using ANE's. Flash Builder 4.6 will be a free upgrade from 4.5 as well.
Q. Is there any documentation for the ANE C API?
A. Yes. Adobe has lots of great content on coding the native implementations of your ANE. http://help.adobe.com/en_US/air/extensions/index.h
I think this answers a lot of the duplicate questions that I have see in several posts. Hopefully with my blog post, Paulo's tutorial that is coming soon, this thread and the Adobe documentation this answers a lot of questions.
10-26-2011 04:37 PM - last edited on 10-26-2011 05:19 PM by MSohm
The tutorial is now available at http://supportforums.blackberry.com/t5/Tablet-OS-S
10-28-2011 05:58 PM - edited 10-28-2011 06:10 PM
Thanks for that - the main hurdle I was having was figuring out what was required from the application descriptor side!
I was wondering if you could answer something for me though - I have created and compiled an extension that brings Android up to speed with what QNX offers.
Rather than make two separate builds of my .swc, I'd essentially like to build an as3 only extension for the QNX side of things - this would also help to keep the interface between android / qnx the same. The Adobe docs mention that this is possible, however there's no documentation to explain how it's done.
Things that aren't clear are:
1. What would the platform descriptor look like, seeing as it would not really have a nativeLibrary?
<platform name="QNX-ARM"> <applicationDeployment> <nativeLibrary>libNativeCode-arm.so</nativeLibrary
> <initializer>extensionInitializer</initializer> <finalizer>extensionFinalizer</finalizer> </applicationDeployment> </platform>
2. How would you set up an initializer / finalizer seeing as the code is all in as3?
3. What should the qnx xml file look like at a basic level? What's the minimum requirements of this file for a native extension? Where do you set the permissions (like use_camera etc)?
11-08-2011 03:58 PM
For 1 and 2 this should work fine. Just make sure you have the library.swf that has all of the as3 code bundled as part of that platform.
<platform name="QNX-ARM"> <applicationDeployment/> </platform>
Just make sure you add <action>run_air_native</action> to it. However, if you don't have any native code in your ANE then you might not need that.
11-20-2011 06:14 AM
any strategies/tips for debugging the ANE? I.e. breakpoints, tracing, inspecting the native side etc.
Is it possible to install the Flash Builder plugin into the Momentics Eclipse, or vice versa, and step through from AS to C/C++?
Cheers, - Jon -
11-23-2011 03:50 PM
Theoretically it is possible to install both Momentics IDE and Flash Builder in the same eclipse.
Flash Builder supports installing into another eclipse instance, so you select Momentics as eclipse
installation it would install into it. You would have two debuggers though, it would not "step in" the native code
unless you put breakpoint there.
11-23-2011 03:59 PM
Thanks Elena. I tried that once with the NDK 1.0 beta Momentics, but had trouble getting the Flash Builder plugin to run. I'll give it a shot with the 1.0 release and/or 2.0 beta.