Accessibility

Table of Contents

Managing Adobe AIR updates with ColdFusion 8

Updating Adobe AIR applications

Many of the nation's top companies are using Adobe AIR to develop interactive and connected applications. These applications will fuel the next iteration of the Internet. If your plan is to develop the next great AIR application, what will you do after you release your creation to the general public? During the creation process you might not think a great deal about updates, but when a serious coding flaw is revealed, updates could become your primary concern.

Under the hood

The Adobe AIR framework has a built-in mechanism for handling updates. This mechanism is quite powerful because it does not force you, the developer, to handle updates in any certain way. Instead it enables you to integrate updates in whatever manner that would be best for your application.

This mechanism allows you to call a method that will shut down the current application and load the new version while still preserving the data in the local folders. To ensure security and consistency, there are a few important things to keep in mind when using this integrated method for updating an AIR application:

  • The update file must have the same Application ID as the original application.
  • You must know the version number of the new application. You have to pass this to the update function of the Updater class.
  • The application closes to perform the update. You can only control what happens up to the point where you call the update function. When the update is completed, the application will restart.

Performing an update

In ActionScript the updates are handled with the flash.desktop.Updater class, and in JavaScript updates are handled by the air.Updater class. (You must include the AIRAliases.js file in your JavaScript application to use this notation. If you do not, the Updater class can only be referenced by window.runtime.flash.desktop.Updater.) To perform an update in either ActionScript (for Flash or Flex) or JavaScript, you need to follow the same three steps:

  1. Create an instance of the Updater class.
  2. Create a File object with a reference to the new application on your computer.
  3. Call the update function of the Updater class and pass in the version number of the new application.

Here is an ActionScript example from Adobe Livedocs Flex 3 Language Reference:

var updater:Updater = new Updater();
var airFile:File = File.desktopDirectory.resolvePath("Updated_Application.air");
var version:String = "2.01";
updater.update(airFile, version);

Obstacles in the updating process

The Updater class inside of Adobe AIR empowers the developer, but because of the flexibility, the developer has to write the implementation. There is no built-in method that "goes and checks the same place for a new version." In all likelihood, you will implement updates in a similar method across all of your Adobe AIR applications. This makes the update process a prime candidate for a central ActionScript class that will manage the entire update process. However, for this to be effective, it will need to work for any Adobe AIR application irrespective of whether it was created with Flex, Flash, or HTML/JavaScript.

This ActionScript class only manages half of the update process; you'll also need a method for serving the application updates. If the application is put on a web server and made accessible, you have very little ability to control how it is delivered. If older versions are left accessible, there is a risk for some users downloading an outdated version. It would be ideal to store the applications outside of your web tree and simply serve them when they are requested. This also leaves the door open for extensibility, because if you ultimately control the content, you can control how and when it is delivered.

The plan

To bring these ideas to fruition, both a client-side implementation and a server-side implementation will be needed.

  • Server-side implementation: This implementation consists of a database that stores information about the application releases. It serves the application files and returns information about which AIR file is the most up-to-date version. It also needs a front-end where the developer can enter the new versions of the AIR application. ColdFusion 8 will be powering the server-side.
  • Client-side implementation: This implementation needs to be able to ask the server for information on the latest update. It also has to react differently to different types of updates (critical, major, minor). The client side can either be a Flash, Flex, or HTML/JavaScript application built on AIR.