Adobe AIR Auto Update

Adding an auto update to your AIR program isn't really as hard as some how-to's online make it seem. Let me put a few code blocks here that will help you go understand how this can be accomplished.

First off.. create a function to create the auto-update object and add listeners.. then call the update.. like so:

import air.update.ApplicationUpdaterUI;

import flash.filesystem.File;

import mx.controls.Alert;

private var appUpdater:ApplicationUpdaterUI;

public function checkForUpdate():void
trace("checking for new application");

appUpdater = new ApplicationUpdaterUI();
appUpdater.configurationFile =
appUpdater.addEventListener(UpdateEvent.INITIALIZED, updaterInitialized);

private function onError(event:ErrorEvent):void

private function updaterInitialized(e:UpdateEvent):void
trace("checking for updates");

Once you have that in place you have to have a few xml files to reference. The first is clientside that the air client references when it loads. This file tells the air app the location on the web it needs to go to in order to find an xml file with update information. In our above code we called it update_config.xml. This file was put in our assets/cfg folder. You can find more documentation online about the different variables this config file takes.. but this is a base version. This file would look something like this:

<?xml version="1.0" encoding="utf-8"?>
<configuration xmlns="">
<dialog name="checkForUpdate" visible="false" />
<dialog name="downloadUpdate" visible="true" />
<dialog name="downloadProgress" visible="true" />
<dialog name="installUpdate" visible="true" />

Alternatively.. you can just put the config options inline instead of loading an xml file.. like so:

appUpdater.delay = 1;
appUpdater.updateURL = "http://localhost/updater/update.xml";
appUpdater.isCheckForUpdateVisible = false;
appUpdater.isDownloadUpdateVisible = true;
appUpdater.isDownloadProgressVisible = true;
appUpdater.isInstallUpdateVisible = true;

Lastly the file that is loaded by air from the web is referenced in this config xml as update_descriptor.xml. This file looks something like this:

<?xml version="1.0" encoding="utf-8"?>
<update xmlns="">
<version>version of your app.. either a number or letter sequence..
like 1.2.3</version>
<description>This will show up in the update dialog.</description>

I think the tags in this xml file make it somewhat easy to understand what each piece does. I hope this helps clear things up because for me it took a little time to put all the pieces together.

You need to make sure the version number in your air application matches the version in your update_descriptor.xml when you deploy an update.

Happy Flashing!