Using the Update Framework for Adobe AIR

One feature that I was more useful in Adobe AIR, was the addition of an API designed to make better automatic update of my application. This can be very important because not all users have the time (or desire) to return the application site to download the latest version.
This is already routine for operating systems and software that we use in day-to-day as the Mozilla Firefox and Google Chrome or TweetDeck.

From Adobe AIR 1.5, we have the class ApplicationUpdater and ApplicationUpdaterUI which aims to define the basic functionality to update the applications made with Adobe AIR

Manage updates and can be tricky, AIR update framework has the API’s necessary for you to do this in a practical and functional. The developer can, for example:

  • Periodically checking for updates based on an interval or at the request of the user
  • Downloading AIR files (updates) from a web source
  • Alerting the user on the first run of the newly installed version
  • Confirming that the user wants to check for updates
  • Displaying information on the new update version to the user
  • Displaying download progress and error information to the user

The information is derived from XML files where you say that the latest version of software, new version of the news etc. Let’s take a practical example, if you use Flash Builder should already have the files applicationupdater.swc and applicationupdater_ui.swc as a reference in the library.
We started by calling xml updateConfig.xml, that “say” to your application where are the files to update.
[XML]


http://localhost:81/leonardofranca/air/updates/testeUpdate/updateDescriptor.xml
1

[/XML]
It must be saved in the same directory of your application, along with other xml and swf files. Now in Flex, instantiate the class ApplicationUpdateUI and setting the configuration xml file so that Flex can know where is the update.
[ACTIONSCRIPT3]
var appUpdater:ApplicationUpdaterUI = new ApplicationUpdaterUI();
appUpdater.configurationFile = new File(“app:/updateConfig.xml”);
appUpdater.initialize();

//via ActionScript
//appUpdater.updateURL = ” http://example.com/updates/update.xml”;
//appUpdater.delay = 1;
[/ACTIONSCRIPT3]

The file updateDescriptor.xml is where you set the version in the update of your application and where you can add a description of the news update.
[XML]


0.0.2
http://localhost:81/leonardofranca/air/updates/testeUpdate/testeUpdate_0.0.2.air


[/XML]

Basically that’s it, we will only implement the call to open the application, it checks if there is update.
[MXML]








[/MXML]
I created a second version of my test application for demonstration, we have the following result:

Check for update

Click to view

If you want to see if there are any updates of the application, just click on “check for upadates. The updated file is downloaded and installed.

Click for view


Click for view


Click for view

References:
http://help.adobe.com/en_US/air/build/WS9CD40F06-4DD7-4230-B56A-88AA27541A1E.html
http://www.adobe.com/devnet/air/flex/quickstart/articles/update_framework.html

Was this article helpful? feel free to make a donation and help keep the blog in the air
Adobe AIR, Flash, Flex , ,

7 comments


Leave a Reply