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.
2 Comments
usefull information. I was looking for it.
But I don’t like the idea of it being accessible to the user…we never know. Don’t you think ?
I use a VERSION const in the application….and disrespect “unicity” of information by having it in two places at my own risks. One of my ex teachers would kill me :)
“Will post a complete walkthrough of using the Updater API along with several other examples after my talk at FITC Amsterdam.”
thankyou Peter. looking forward to reading them.
“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’s no other way to push updates to the user, other than the app calling home to check first when it loads, yes?