AIR Remote Updater for AIR 1.0
A new version of the AIR Remote Updater (for AIR 1.0 release) is available for download here:
http://codeazur.com.br/lab/airremoteupdater/
The AIR Remote Updater is an Actionscript 3 class to automate remote software updates in Adobe AIR applications.
It transparently checks version numbers, downloads the .AIR installer file if needed and triggers the AIR-native update process. It grabs the version number directly from the remote .AIR file without having to download the entire file, eliminating the potential error prone need of having to put a separate descriptor file online along with the .AIR installer file.
February 26th, 2008 at 6:47 pm
Can it be done silently? In most cases I suppose the application would have to restart, but…but….
Can it do incremental (multiple if needed)?
March 8th, 2008 at 5:00 am
The application always needs to restart in order to update itself. The rest can be silent of course (that’s the default behavior).
Unsure what you mean exactly with incremental updates, but i guess not.
March 25th, 2008 at 2:53 pm
Thanks for this code. Excited to tuse it. But, I’m getting an error… “This method is not supported if application is launched from ADL.”
Version detection works but I get the error right after the file name is output.
I’ve spent some time looking for the problem but I’m too new at this.
April 1st, 2008 at 2:13 am
Stuart Ruah: That error is because you’re running the application from the “Adobe Debugging Layer”, please export your application to a package and then run it, then it will work.
I have a question to Claus Wahlers:
If you use versions like v0.5 RC2 or anything that uses non-numeric values, the updater won’t work. Looked up in the code and the function compareVersions() fails, because it wants to parseFloats from the both the versions, i know I should use only numeric values now. But this is known?
April 1st, 2008 at 2:21 am
With ADL I meant “AIR Debug Launcher”, my mistake
April 1st, 2008 at 2:28 am
Ronald: Of course AIRRemoteUpdater can’t possibly understand every arbitrary version string.
However there is an easy way to write your own comparison algorithm that is able to handle your particular version strings: Just listen to
AIRRemoteUpdaterEvent.VERSION_CHECK, and in the event handler callevent.preventDefault(). You can then parse and comparelocalVersionandremoteVersionyourself. If local is newer, callupdatewith theversionCheckparameter set tofalse.A little warning: AIR itself checks the new against the installed version when it updates your app, and i’m not sure what algorithm they use there.
May 27th, 2008 at 11:16 am
The code downloads a new version of the AIR file, and shuts down the current app, but the new version’s installer never runs. It has the effect of looking like the application crashed. I’ll try to debug what is happening, but so far, this is a show-stopper for me.
May 27th, 2008 at 4:18 pm
Looks to be something wrong with my PC. The code worked perfectly on a co-worker’s machine.
June 6th, 2008 at 2:28 am
Thanks for the code, walked into a little GOTCHA, the installer was throwing an error once the new version was downloaded - “This application cannot be installed because this installer has been mis-configured. Please contact the application author for assistance.”
My error was:
I interupted VERSION_CHECK event to ask user if they wanted to update. If they clicked yes then called the update method with the versionCheck param to false, but … using a new instance of AIRRemoteUpdater, this doesn’t work because unless you have called update with the versionCheck param set to true the _remoteVersion variable is empty, AIR needs the new version number to verify the update and so without it the update fails.
June 7th, 2008 at 3:02 am
John, yes that’s obvious. You should reuse the original instance (for example in your event handlers via event.target - or you instantiate it on a class member and access it directly)