Air Updater made easy, with scheduling

November 25, 2009 by fMajakovskij

If you are developing an Air application, you should to know how it is important to use the great automatic update process provided by the Air framework. Having the option to fix some bugs or give more features to your users, with a seamless process, is quite amazing.

If you are using Flash CS4, you must include manually a required library, which is already present in Flash CS4.
In Publish Setting / Flash / Settings of ActionScript 3.0, select the Library path tab. Add a new field and search in your system the applicationupdater_ui.swc library:

// inside the Flash CS4 folder, follow this path to find the library to include:
AIK1.5/frameworks/libs/air/applicationupdater_ui.swc

Now I will explain how to include this feature by using a custom class, available for download, which allow to run, at scheduled time, the process using one line of code, pretty like to:

import maja.air.AppUpdater

var pathToXml:String = "http://www.myServer.com/myApp.xml"
var schedulingDays:int = 7
var update:AppUpdater = new AppUpdater(  pathToXml , schedulingDays )

Where the pathToXml is the absolute path to an xml file put online on your server, and schedulingDays stand for the number of days to wait for check from the last available check, so the periodical check (default: 7, use 0 to force the check each application run).

The xml file should be look like to:


1.1

http://www.yourserver.com/yourApp.air

1.1: fixed a lot of bugs
]]>


[/code] The version number in the xml and in the application must coincide when you deploy the update.

Be sure to resolve the absolute path correctly, the xml path in you application and the application path in your xml as well.

Download the [download id="4"] class which is pretty commented to learn how it works (which is however simple).

5 thoughts on “Air Updater made easy, with scheduling

  1. Srinivas says:

    Thank you so much for the code,
    But I have one question, How can I make it work with Flash CS3? Is there any way by which I can make it work with CS3
    Please help

    • fMajakovskij says:

      Since I don’t use Flash CS3, I don’t know why it doesn’t work on it. I think there are some differences for example you have to include an external .swc file which Flash CS3 can’t do. You should check the CS3 reference to solve it.

  2. Srinivas says:

    Thank you so much for your reply!
    I tried, for one of my project, I am struggling to make it work with CS3, even though i have changed the AIK to AIK 1.1 still it doesn’t work.

    Can you give any suggestion..

  3. sol says:

    Tried to use your tutorial. I get this when compiling:

    VerifyError: Error #1079: Native methods are not allowed in loaded code.

Leave a Reply

Your email address will not be published. Required fields are marked *

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>