côdeazur brasil blog

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.

10 Responses to “AIR Remote Updater for AIR 1.0”

  1. hosey Says:

    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)?

  2. Claus Wahlers Says:

    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.

  3. Stuart Rauh Says:

    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.

  4. Ronald Drenth Says:

    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?

  5. Ronald Drenth Says:

    With ADL I meant “AIR Debug Launcher”, my mistake :)

  6. Claus Wahlers Says:

    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 call event.preventDefault(). You can then parse and compare localVersion and remoteVersion yourself. If local is newer, call update with the versionCheck parameter set to false.

    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.

  7. Andrew Westberg Says:

    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.

  8. Andrew Westberg Says:

    Looks to be something wrong with my PC. The code worked perfectly on a co-worker’s machine.

  9. John Bicknell Says:

    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.

  10. Claus Wahlers Says:

    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)

Leave a Reply

XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>