Moods

AIR install badge

3 Comments 02 September 2010

AIR install badge

Now that the Adobe AIR Launchpad is available on labs.adobe.com, I’m sure that you’ll start developing a lot of desktop applications. Then, you’ll certainly want to know how to deploy them. On the last screen of the AIR Launchpad, you can create an install badge. In case you don’t know what this is or how it works, I’ll explain to you why this is a first-class deployment option to create a seamless installation process of your AIR application.

The Adobe AIR install badge is just a small Flash application that you can embed on your website. If you want to see how it looks, check this webpage: http://www.adobe.com/devnet/flex/tourdeflex/ If someone visits your website and clicks on the badge to install your AIR application, the badge will verify that he has the required version of Adobe AIR installed. If it’s not the case, then it will automatically install the Adobe AIR runtime (the last release available on adobe.com). Then it will install your AIR application on the user’s computer. The Adobe AIR runtime is not as deployed as the Flash Player plug-in. That’s the reason why it’s critical to check if the AIR runtime is installed on your users’ computers.

How can a SWF file, embedded in an HTML page, check if the Adobe AIR runtime is installed? I directly asked this question to the Adobe AIR team (you can check their blog). Rob and Franck answered my question with detailed information:

“The install badge makes use of a private Flash Player API  that can query the system for specific files at specific locations. This API requires Flash Player 9.0.115 and above. The only way to use this API is to rely on the air.swf file, hosted on adobe.com. It exposes a higher level API to badges hosted on third party sites. The APIs that air.swf implements allow badges to query if AIR is installed, if a particular AIR application is installed, install an AIR application, and launch an AIR application.”

You can customize the install badge. The source code is located in the  ‘samples’ folder of the Flex SDK. A default badge.swf is provided, and just using FlashVars, you can customize the application name, the application url, the AIR version required, the image, etc… Now you understand what the AIR launchpad does. It creates a HTML Wrapper with the correct FlashVars. But, you can also create your own badge.swf file. The FLA source file is provided.

Thanks to the air.swf file hosted on Adobe.com (http://airdownload.adobe.com/air/browserapi/air.swf), you can easily check the configuration of the users who want to install your application. Look at this sample code:

import flash.display.Loader;
 
import mx.controls.SWFLoader;
 
var airSWF:Object;
var airSWFLoader:SWFLoader = new Loader();
airSWFLoader.load(new URLRequest("http://airdownload.adobe.com/air/browserapi/air.swf"));
 
// CHECKING IF THE RUNTIME IS INSTALLED
 
var status:String = airSWF.getStatus();
// "available": the runtime can be installed and is currently not installed
// "unavailable": the runtime cannot be installed on this computer
// "installed": the runtime is installed on this computer
 
//CHECHING IF YOUR AIR APPLICATION IS INSTALLED
var appID:String = "com.example.air.myTestApplication";
var pubID:String = "02D88EEED35F84C264A183921344EEA353A629FD.1";
airSWF.getApplicationVersion(appID, pubID, versionDetectCallback); 
 
function versionDetectCallback(version:String):void
{
	if (version == null)
	{
		trace("Not installed.");
	}
	else
	{
		trace("Version", version, "installed.");
	}
}
 
//INSTALL YOUR AIR APPLICATION
var url:String = "http://www.example.com/myApplication.air";
var runtimeVersion:String = "1.0";
var arguments:Array = ["launchFromBrowser"]; // Optional
airSWF.installApplication(url, runtimeVersion, arguments);
 
//LAUNCH YOUR AIR APPLICATION FROM THE BROWSER
var appID:String = "com.example.air.myTestApplication";
var pubID:String = "02D88EEED35F84C264A183921344EEA353A629FD.1";
var arguments:Array = ["launchFromBrowser"]; // Optional
airSWF.launchApplication(appID, pubID, arguments);

As you can see, this is quite powerful. Some developers started to develop their own badge installers. This one by Taterboy is interesting as it lets you change easily the size of the badge: http://www.taterboy.com/blog/2009/12/create-adobe-air-badges-at-any-size/ You’ll also find some wizards to rapidly create a custom badge. The most famous one is the badger application developed by Grant Skinner.

Here are two excellent resources to help you understand how to create a custom badge:
– Article on devnet: http://www.adobe.com/devnet/air/articles/air_badge_install.html
– This page in the AIR help files: http://help.adobe.com/en_US/air/build/WS5b3ccc516d4fbf351e63e3d118666ade46-7e15.html

Post to Twitter

Your Comments

3 Comments so far


Trackbacks/Pingbacks

  1. AIR INSTALL BADGE « rksaran - September 2, 2010
  2. Localisation, Mike Chambers et AIR « Code moi un mouton - September 3, 2010

    […] – Sinon, l’équipe a lancé une application, le AIR launchpad pour ceux qui souhaitent un assistant de développement d’applications AIR. J’en parle ici: http://www.riagora.com/2010/08/adobe-air-launchpad/. Je me suis aussi plongé dans deux sujets pour l’occasion. Le preloader Flex 4 personnalisé avec Spark: http://www.riagora.com/2010/08/custom-flex-4-preloader/ et la création d’un badge d’installation automatique d’une application AIR: http://www.riagora.com/2010/09/air-install-badge/ […]

Share your view

Post a comment

Who am I ?

I'm Michaël CHAIZE, Adobe Flash Platform Evangelist based in Paris. I'm a big fan of Rich Internet Applications and I promote the Flash Platform in the Enterprise world.
You can follow me on twitter: http://twitter.com/mchaize

Magazine

Follow us on Facebook

© 2018 RIAgora. Powered by WordPress.

Daily Edition Theme by WooThemes - Premium WordPress Themes