So you are an Android guy. Or gal. Or, you are an ActionScript person, who wants to expand to Android. Same difference.
Here is a bit of prerequisite information, in case you need it:
Next, let us see the ingredients that you have to provide for an ANE and those that are provided for you.
You will have to make two libraries:
- an AIR library, compiled as a .swf file;
- a native Java library, compiled as a .jar file.
The communication by these two libraries is handled by another component, which Adobe has provided for you:
- the AIR Java API.
The AIR library
Your AIR library is a Flex library project, which contains an instance of flash.external.ExtensionContext. ExtensionContext is the class that provides an ActionScript interface for you to make calls to and receive messages from your Java .jar library.
The AIR Java API
The AIR Java API is the layer that sits between your ActionScript and Java code. It ‘translates’ the ActionScript calls you make to ExtensionContext into Java and allows you to send events and data from Java back to ActionScript.
The AIR Java API is part of Adobe’s AIR SDK and is implemented as a .jar library, which you include in your native library project (see below).
The native library
Your native library will be a .jar that uses the AIR Java API – in red on the diagram below. It can also include any number of Android SDK or third party libraries.
The ANE package
In order to be used as a native extension, your AIR and your native libraries need to be packed in an .ANE file. Adobe’s ADT command line tool does that for you. We will see how in Recipe for packaging an ANE.
- What goes into an ANE for iOS?
- What goes into an ANE for Mac OS?
- What goes into an ANE for Windows?
- Prepare your ANE to be used in an app
Over to you
What problems have you run into on Android that require native extensions? Share in the comments below.
Leave a Reply