Adobe AIR 3.0 introduces an exciting new feature: AIR Native Extensions. This is an architectural enhancement that lets you expand the capabilities of your AIR applications. By using native extensions, you can: access native features of devices; perform multi-threaded operations; and offload hard tasks to highly optimized, native libraries.
Native extensions are used by creating .ANE files, which combine ActionScript 3 code with native code, such as C++, Java, and Objective-C. You then package the native extension into your applications, and access the features as you would any other ActionScript 3 API.
Adobe has created some sample native extensions to get you started:
- Access the vibration motor of Android and iOS devices: Vibration native extension.
- Use the gyroscope on Android and iOS devices: Gyroscope native extension.
- Query each network interface on iOS, and obtain network information such as addresses, the MTU, the network name, etc: NetworkInfo native extension.
I’ve worked on two native extension resources that will soon be available via my blog:
- A notification native extension, for dispatching native notifications on Android and iOS devices.
- A complete tutorial on creating your own native extension from the ground up.
You can get started today by downloading the Adobe AIR 3.0 Release Candidate from Adobe Labs and referring to the above samples. You’ll have to compile and package your applications using the command line tool adt. Once builds of Flash Builder 4.6 are available, however, you’ll be able to create apps that use native extensions without using command line tools.
Check back soon to learn about getting access to Flash Builder 4.6, to download the notification native extension sample, and to read my tutorial on creating your own.
- “Extending Adobe AIR,” by Oliver Goldman