Accessing the ANE in code
To the App code, your ANE looks just like SWC. (In fact, during authoring, it is using the SWC that you packaged into the ANE.) So you just instantiate the classes or call static methods defined by the ActionScript side of the extension.
Note that the App code never uses the ExtensionContext class. That's for the ActionScript inside the extension only.
Here's a short example app that uses an ANE that defines the class com.example.DataExchange. As you can see, there's nothing special goin on (on the surface):
public class DataExchangeUser extends Sprite
private var de:DataExchange = new DataExchange();
public function DataExchangeUser()
if( de != null )
trace( "Boolean test pass? " + (de.negateBoolean( false ) && !de.negateBoolean( true )) );
else trace("Null context");
Reference the extension in the application descriptor
The application descriptor of the app must reference the extension by ID within an <extensions> element:
<extensions> <extensionID>extension.first</extensionID> <extensionID>extension.next</extensionID> <extensionID>extension.last</extensionID> </extensions>
Packaging the App
You package an app using an ANE in the same way as any other, with one crucial difference: you must use the -extdir flag to include the ANE file. (Just putting it in the app package like any other file won't work.)
Here's an example:
adt -package -target apk-debug
-storetype pkcs12 -keystore /Users/cward/Documents/AndroidCert.p12 -storepass ####
Again, that last line is crucial, without the -extdir, your app package will include the ANE, but won't know what it is.