air program auto update.

Air Application Auto-Update

July 30th, 2008

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

air-updater

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
(
)
;
}
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值