Skip to main content
Inspiring
October 30, 2011
Answered

Flash Builder 4.5.1 - Air ApplicationUpdaterUI Auto Update Fails

  • October 30, 2011
  • 1 reply
  • 1861 views

I just reinstalled my FlashBuilder 4.5.1 and built a new HelloWorld App

in order to test the SDK 2.6 with the Air ApplicationUpdaterUI.

I get no errors but it won't update using the 2.6 namespace in both the -app.mxml and update.xml on server.

A trace in the StatusUpdateEvent never shows up in debug mode.

The only window that pops up is the one asking to Check for Update?

Pulling my hair out - must be something obvious I'm doing wrong here - can a new set of eyes spot something?

Main xml file:

<?xml version="1.0" encoding="utf-8"?>

<s:WindowedApplication xmlns:fx="http://ns.adobe.com/mxml/2009"

                       xmlns:s="library://ns.adobe.com/flex/spark"

                       xmlns:mx="library://ns.adobe.com/flex/mx"

                       creationComplete = "checkForUpdate();" title="Test Air Updater">

    <fx:Declarations>

        <!-- Place non-visual elements (e.g., services, value objects) here -->

    </fx:Declarations>

    <fx:Script>

        <![CDATA[

            import air.net.URLMonitor;

            import air.update.ApplicationUpdaterUI;

            import air.update.events.StatusUpdateErrorEvent;

            import air.update.events.StatusUpdateEvent;

            import air.update.events.UpdateEvent;

            import flash.events.ErrorEvent;

            import mx.controls.Alert;

            import mx.events.CloseEvent;

            import mx.events.FlexEvent;

            private const APP_VERSION_FILE:String     = "http://www.public-knowledge.com/Quest/Timesheets/new_app_version.xml";

            private var appUpdater:ApplicationUpdaterUI = new ApplicationUpdaterUI();

            private function checkForUpdate():void {

                // Add events

                appUpdater.addEventListener(UpdateEvent.INITIALIZED, onInitialized);

                appUpdater.addEventListener(StatusUpdateErrorEvent.UPDATE_ERROR, onUpdateStatusError);

                appUpdater.addEventListener(StatusUpdateEvent.UPDATE_STATUS, updateStatusHandler); 

                appUpdater.addEventListener(ErrorEvent.ERROR, onError); // If something goes wrong, run onError               

                appUpdater.isCheckForUpdateVisible = true;

                appUpdater.isUnexpectedErrorVisible = true;

                appUpdater.isDownloadUpdateVisible= true;

                appUpdater.isDownloadProgressVisible=true;

                appUpdater.isInstallUpdateVisible = true;               

                appUpdater.updateURL = APP_VERSION_FILE; // Server-side XML file describing update               

                trace(APP_VERSION_FILE);

                appUpdater.initialize();

            }

            private function onError(event:ErrorEvent):void {

                Alert.show('ERROR: ' + event.toString());

            }

            private function onUpdateStatusError(event:StatusUpdateErrorEvent):void {

                Alert.show('Error Checking For Update: ' + event.toString());

            }

            private function onInitialized(event:UpdateEvent):void {

                trace('Checking For Updates ...');       

                appUpdater.checkNow();

            }

            private function updateStatusHandler(event:UpdateEvent):void {

                //var descriptor:XML = NativeApplication.nativeApplication.applicationDescriptor;

                //var ns:Namespace   = descriptor.namespaceDeclarations()[0];

                //var verNum:String  = descriptor.ns::versionNumber;

                trace('Update Event Reached ...');       

            }

        ]]>

    </fx:Script>   

    <s:TitleWindow x="63" y="35" width="250" height="200" title="Hello">

        <s:Label x="24" y="80" text="Hello World"/>

    </s:TitleWindow>

</s:WindowedApplication>

-App.MXML File: (first part)

<?xml version="1.0" encoding="utf-8" standalone="no"?>

<application xmlns="http://ns.adobe.com/air/application/2.6">

<!-- Adobe AIR Application Descriptor File Template.

    Specifies parameters for identifying, installing, and launching AIR applications.

    xmlns - The Adobe AIR namespace: http://ns.adobe.com/air/application/2.6

            The last segment of the namespace specifies the version

            of the AIR runtime required for this application to run.

    minimumPatchLevel - The minimum patch level of the AIR runtime required to run

            the application. Optional.

-->

    <!-- A universally unique application identifier. Must be unique across all AIR applications.

    Using a reverse DNS-style name as the id is recommended. (Eg. com.example.ExampleApplication.) Required. -->   

    <id>ca.questgeomatics.testairapp</id>

    <!-- Used as the filename for the application. Required. -->

    <filename>TestAirUpdater</filename>

    <!-- The name that is displayed in the AIR application installer.

    May have multiple values for each language. See samples or xsd schema file. Optional. -->

    <name>TestAirUpdater</name>

    <!-- A string value of the format <0-999>.<0-999>.<0-999> that represents application version which can be used to check for application upgrade.

    Values can also be 1-part or 2-part. It is not necessary to have a 3-part value.

    An updated version of application must have a versionNumber value higher than the previous version. Required for namespace >= 2.5 . -->

    <versionNumber>1.0.0</versionNumber>

    <!-- A string value (such as "v1", "2.5", or "Alpha 1") that represents the version of the application, as it should be shown to users. Optional. -->

    <versionLabel>v 1.0.0</versionLabel>

Updater XML file (new_app_version.xml):

<?xml version="1.0" encoding="utf-8"?>

<update xmlns="http://ns.adobe.com/air/framework/update/description/2.6">

<versionNumber>1.0.1</versionNumber>

<versionLabel>v 1.01</versionLabel>

<url>http://www.public-knowledge.com/Quest/Timesheets/TestAirUpdater.air</url>

<description><![CDATA[

* First official release that implemements Auto Updating feature

]]></description>

</update>

Bolded appl descriptor versions Message was edited by: DonMitchinson

This topic has been closed for replies.
Correct answer DonMitchinson

Status Update - don't know if this is a bug, design flaw, install problem or my misunderstanding.

I got it to work by first changing my Flex library to 4.5.0 - still didn't work with current

app and update mxml files using "2.6" for their namespace versions. But I did at least

get the popup error number 16815 - indicating an error in the update version namespace.

By leaving my application namespace version at "2.6" and changing the update version to "2.5" ... bingo!

I got my new update installed autiomatically.

Is this how it's supposed to work - or are my runtimes mixed up?

Will this work the same using the Flex 4.5.1 SDK? I'll find out shortly

Hope this helps others.

1 reply

DonMitchinsonAuthorCorrect answer
Inspiring
October 31, 2011

Status Update - don't know if this is a bug, design flaw, install problem or my misunderstanding.

I got it to work by first changing my Flex library to 4.5.0 - still didn't work with current

app and update mxml files using "2.6" for their namespace versions. But I did at least

get the popup error number 16815 - indicating an error in the update version namespace.

By leaving my application namespace version at "2.6" and changing the update version to "2.5" ... bingo!

I got my new update installed autiomatically.

Is this how it's supposed to work - or are my runtimes mixed up?

Will this work the same using the Flex 4.5.1 SDK? I'll find out shortly

Hope this helps others.

Inspiring
October 31, 2011

And yes - all is fine now using Flex 4.5.1 and the mismatched namespace versions