If you've played around with AIR and are thinking about releasing some applications into the wild, you'll want to make sure you have something in place to push updates to your users when you've got a new version available. The user can download a new version of your .air file, double-click the file and the AIR runtime will notice its an update to an existing application and notify the user.

There is another way to handle the update process which is much more straightforward to your user. You can access the application descriptor XML of your AIR app and retrieve the version number, check that against the latest version number you store in a text file somewhere on your server.

If the version number on the server is higher than the version of the currently installed AIR app, you download the .air app and trigger an update to happen using the flash.desktop.Updater class.

Getting hold of that version number in the application descriptor is however not as straightforward as you might expect and requires the following code:

var descriptor:XML = NativeApplication.nativeApplication.applicationDescriptor;
var ns:Namespace = descriptor.namespaceDeclarations()[0];
var version:String = descriptor.ns::version;

  I personally would've liked to see the version number, name and other commonly used settings from the applicationDescriptor as properties on NativeApplication.nativeApplication. I'm yet to find a need to work with the raw applicationDescriptor XML and it seems needlessly verbose to retrieve a simple value.

Will post a complete walkthrough of using the Updater API along with several other examples after my talk at FITC Amsterdam.

Posted
AuthorPeter
CategoriesAIR