I just wasted a few hours on understanding how to update an AIR app from the 2.0 namespace (or earlier) to the brand new 2.5 one. As you may know, two new tags have been introduced (“versionNumber” and “versionLabel”) to replace the old “version” one.
To avoid breaking things you have to create an intermediary app version that will smoothly switch from 2.0 to 2.5, here’s what you can read on the release notes page:
In order to be able to update from version 1 to version 2, an intermediary update step must be added as follows: application version 1, packaged with AIR 2 and using the 2.0 namespace gets updated to: application version 1.5, packaged with AIR 2.5 and using the 2.0 namespace. This version of the application must include the version of the Application Updater SWC/SWF included with the AIR 2.5 SDK. This gets updated to: application version 2.0, packaged with AIR 2.5 and using the 2.5 namespace.
Where “application 1.5″ is the intermediary step.
All of this looks quite simple but really it isn’t; or at least it wasn’t for me. To be really explicit here are my 3 application descriptors and the update descriptor (version numbers changed to match Adobe’s example).
Application descriptor – Version 1 (packaged with AIR 2.0):
<?xml version="1.0" encoding="utf-8" standalone="no" ?>
<application xmlns="http://ns.adobe.com/air/application/2.0">
(...)<version>1</version>(...)
</application>
Application descriptor – Version 1.5 (packaged with AIR 2.5):
<?xml version="1.0" encoding="utf-8" standalone="no" ?>
<application xmlns="http://ns.adobe.com/air/application/2.0">
(...)<version>1.5</version>(...)
</application>
Application descriptor – Version 2 (packaged with AIR 2.5):
<?xml version="1.0" encoding="utf-8" standalone="no" ?>
<update xmlns="http://ns.adobe.com/air/framework/update/description/2.5">
(...)<versionNumber>2</versionNumber>(...)
</update>
Update descriptor (PHP script receiving the caller’s current version as “currentVersion” GET variable):
<?php
header("Content-Type: text/xml; charset=utf-8");
echo '<?xml version="1.0" encoding="utf-8"?>';
$currentVersion=
array_key_exists('currentVersion',
$_GET) ?
(float
)$_GET['currentVersion'] :
1;
$isNewNamespace=$currentVersion>=2;
$ns='http://ns.adobe.com/air/framework/update/description/'.($isNewNamespace ? '2.5' : '1.0');
$version=$currentVersion>=1.5 ? 2 : 1.5;
$versionTag=$isNewNamespace ? 'versionNumber' : 'version';
?>
<update xmlns="<?php echo $ns ?>">
<<?php
echo $versionTag ?>><?php
echo $version ?></
<?php echo $versionTag ?>>
<url>http://www.your-site.com/update/your-app-<?php echo $version ?>.air</url>
</update>
Not that simple, right? And this is not only annoying to the developer, but also to the end user. He will be notified of an update from version 1 to 1.5 and when he’s done he’ll get prompted about the new-new version (2): bang, another update process.
If you’re curious of how I send the app’s version to the update descriptor, here it is:
_appUpdater.updateURL='http://www.your-site.com/update/version.php?currentVersion='+App.getVersion();
The App class is available in my as3bits repository.
Some helpful links on the subject:
I hope this helps!