Air Application Auto-Update
There is a SDK at Adobe Labs with a beta of Air Application Updates. There are 2 ways, using the UI update and the headerless update. The headerless allows you to make updates and checks without the end-user knowing the checks.
Lets make a small example.
Short Description:
1.) Local AIR Application read local config file.
2.) The config file points to external (online) config file.
3.) Online Config file holds online released update and path to file.
4.) If file is never, download and upgrade
1.) Download the SDK
1.1) Download the files from Adobe Labs AIR Update Framework .
1.2) Put the 2 *.swc file into your app-folder/sdks/3.0.0/libs/air
2.) Create a Project
2.1) Well, you know how to create a Flex AIR Project =)
3.) The Local Settings File
3.1) Create an XML file in the project (mine is config.xml)
3.2) Change the url path where the online pointer file is.
3.3) If using the GUI version of update change the settings in defaultUI
<configuration xmlns="http://ns.adobe.com/air/framework/update/configuration/1.0"> <url>http://www.undefined-type.com/update-buxfer.xml</url> <delay>1</delay> <defaultUI> <dialog name="checkForUpdate" visible="true" /> <dialog name="downloadUpdate" visible="true" /> <dialog name="downloadProgress" visible="true" /> <dialog name="installUpdate" visible="true" /> <dialog name="fileUpdate" visible="true" /> <dialog name="unexpectedError" visible="true" /> </defaultUI> </configuration>
4.) Create the Online Pointer File
4.1) Create the XML file, (mines called update-buxfer.xml) this is so that I put all my pointer xml file at 1 place on my server.
4.2) Fill the file with example code.
<update xmlns="http://ns.adobe.com/air/framework/update/description/1.0"> <version>1.4</version> <url>http://undefined-type.com/apps/buxfer_1.4.air</url> <description> <![CDATA[ This update enables automatic updates in the future. ]]> </description> </update>
5.) The actual file
5.1) Don’t forget to put the actual new *.air file on the server where you are pointing =)
5.2) When building make sure as well to change the “version” in the application xml file.
6.) The Code
6.1) When you want to check the update just add this code.
import air.update .events .UpdateEvent ; import air.update .ApplicationUpdaterUI ; private var updater : ApplicationUpdaterUI; private function check( ) :void { var confFile : File = File.applicationDirectory .resolvePath ( "config-template.xml" ) ; updater = new ApplicationUpdaterUI( ) ; updater.configurationFile = confFile; updater.addEventListener ( UpdateEvent.INITIALIZED , onInit) ; updater.initialize ( ) ; } private function onInit( event:UpdateEvent) :void { updater.checkNow ( ) ; }