« Flex 4 Skins are Awesome! | Main | Congrats to Open Flex! »
AIR Update Framework
| By Rich Tretola | August 1, 2008 | Print This Post
|
| 942 views |
I have been using the new AIR Update Framework in all of my new AIR applications in place of my UpdateManager that was originally written to handle application updates before the Adobe version was released.
The simplest way integrate this framework into your application is to setup your local configuration file with the checkForUpdate property set to false and all others set to true. This property is not telling the framework to never check for updates, it is simply telling the framework to hide the check for update dialog from the user so they will only see a dialog if an update actually exists.
In the sample below notice that the only other property that is necessary is the address of the remote update file. This local configuration file will ship with your application.
- <?xml version="1.0" encoding="utf-8"?>
- <configuration xmlns="http://ns.adobe.com/air/framework/update/configuration/1.0" >
- <url>http://www.mydomain.com/AIR/Test/update.xml</url>
- <delay>1</delay>
- <defaultUI>
- <dialog name="checkForUpdate" visible="false" />
- <dialog name="downloadUpdate" visible="true" />
- <dialog name="downloadProgress" visible="true" />
- <dialog name="installUpdate" visible="true" />
- </defaultUI>
- </configuration>
The remote file contains only a few properties. Notice the sample below where I have set a version property, url to the newest application file, and a small description which will display in the release notes section of the updater dialog.
- <update>
- <version>.2</version>
- <url>
- http://www.mydomain.com/AIR/Test/myApp.air
- </url>
- <description>
- Added new image rotation feature.
- </description>
- </update>
Finally, within the application do the following:
Create an instance of the updater on line 8
After the application completes, I set the path to the local configuration file within the init function.
Next, I add an eventListener to listen for when the updater is initialized.
Within the eventListener function, I then call the checkNow() function.
Since, we hid the first dialog, the updater will now check for the update and only show the user a dialog when an update exists (see image below). If so, it will then walk them through the rest of the update process.
Here is the full application code:
- <?xml version="1.0" encoding="utf-8"?>
- <mx:WindowedApplication xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute"
- applicationComplete="init()">
- <mx:Script>
- <![CDATA[
- import air.update.events.UpdateEvent;
- import air.update.ApplicationUpdaterUI;
- private var updater:ApplicationUpdaterUI = new ApplicationUpdaterUI();
- private function init():void{
- updater.configurationFile = new File("app:/config/updaterConfig.xml");
- updater.addEventListener(UpdateEvent.INITIALIZED, updaterInitialized);
- updater.initialize();
- }
- private function updaterInitialized(event:UpdateEvent):void{
- updater.checkNow();
- }
- ]]>
- </mx:Script>
- </mx:WindowedApplication>

Topics: Adobe AIR |








August 4th, 2008 at 9:57 am
I have implemented the AIR Updater in my First AIR application. When the version changes the Updater show its messagebox correctly but I receive the following message:
There was an error downloading the update. Error# 16820
I am sure that the remote update.xml and the application-app.xml have the same new version number
Can you help me !!!
August 4th, 2008 at 11:27 am
Did you check to make sure the path to your new AIR file set within the url property of the remote update.xml file is accurate?
August 5th, 2008 at 7:27 pm
Yes it it. Both the update.xml and the application-app.xml have tha same new version and the URL is OK.
The message box appears to download the new version so it is looking in the right place.
August 5th, 2008 at 8:07 pm
So, it downloads but can’t update?
August 25th, 2008 at 7:24 pm
Yes, we tried this as well …
Seems to be a bug …
Any fixes ?
Regards,
Sean.
Free Digital Signage powered by Adobe AIR
http://www.MediaSignage.com
Rich Tretola Reply:
August 25th, 2008 at 7:54 pm
I have not been able to reproduce this issue.
August 29th, 2008 at 12:17 pm
I have run into the same issue. Versions are the same URL is fine. Also it works fine when run on my localhost but once I change the URL’s to my live website it throws the error…”There was an error downloading the update. Error# 16820″. It detects the correct version to be updated, the correct AIR file is in the correct directory.
I am wondering seeing as this only happens when I publish it live if it has something to do with my hosting company. I use Host My Site.com and they are usually up on things. I tried changing file permissions on the folder containing the app but that did not work either. I have a feeling it might have something to do with it being on a shared hosting server.
Anyone have any thought or suggestions?
Chris Reply:
August 29th, 2008 at 12:24 pm
BTW… When my app checks for the update it sees the “Installed Version” and the “Update Version” in the “Update Available” window, but never downloads the app like Sean is describing above. As soon as I click on the “Download Now” button it throws the “Download Failed” error message.
September 3rd, 2008 at 8:52 am
I think the application ID has to be the same, and also the certificate.
September 16th, 2008 at 5:02 am
2Chris: Make sure, that inside “update.xml” you point to correct download path of your AIR application.
I’ve also had received Error# 16820 before, because the download path of AIR application inside “update.xml” file was incorrect.