Launching an installed AIR application from the browser

I needed implements in my project, a particularity interesting, a web application (Flash) launching an Adobe AIR application. First i thought use LocalConnection Class, but could not implement without the Adobe AIR application was launch.
The job was left aside until I remembered the Adobe Media Player does just that, if you already have it installed on the computer, it just open the application.

Adobe AIR has a file called air.swf(http://airdownload.adobe.com/air/browserapi/air.swf) that contains an API to faclitate the interaction between runtime and some Adobe AIR application from a web page. To do this you must load the air.swf for the same domain of your web application, is possible:

  • Checking if the runtime is installed.
  • Checking from a web page if an AIR application is installed.
  • Installing an AIR application from the browser.
  • Launching an installed AIR application from the browser.

Let the examples, first i will create a new project type Desktop Application in Flex Builder, this applcation will be appened by browser later. I need to configure the applicationID and publisherID, without these parameters, the application will be not open.
The applicationID is configured when you create the project or later int the id tag of your file .xml.
[XML]
br.com.leonardofranca.files.lauchApp
[/XML]
For publisherID, we need to use a digitally signing. I will set up a profect so for the purpose of exemplification (password is 123). I will simply have access to publisherID after instaling my Adobe AIR application.
The last detail is to use the allowBrowserInvocation tag.
[XML]
true
[/XML]
The xml configuration file will be as below:
[XML]


br.com.leonardofranca.files.lauchApp
lauchApp
lauchApp
0.0.1

[This value will be overwritten by Flex Builder in the output app.xml]

true

[/XML]
And our mxml:
[MXML]






[/MXML]

Now let the party will be responsible for making the call to open the application. I created a project type Web Application in Flex Builder. As explained above, this application needs to load the air.swf for the domain to the call the method launchApplication passing the parameters applicationID and publisherID.
Is has not mystery, folows the complete code.
[MXML]






[/MXML]

We should have the following result:

Abrindo um aplicativo em Adobe AIR pelo browser

Launching an installed AIR application from the browser

DOWNLOAD SOURCE 1

DOWNLOAD SOURCE 2We

References:
Installing and running AIR applications from a web page:
http://help.adobe.com/en_US/AIR/1.5/devappsflex/WS5b3ccc516d4fbf351e63e3d118666ade46-7e15.html
Sobre o applicationID:
http://help.adobe.com/en_US/AIR/1.5/devappsflex/WS5b3ccc516d4fbf351e63e3d118666ade46-7ff1.html#WS5b3ccc516d4fbf351e63e3d118666ade46-7c9c
Sobre o publisherID e certificados digitais suportados pelo Adobe AIR
http://help.adobe.com/en_US/AIR/1.5/devappsflex/WS5b3ccc516d4fbf351e63e3d118666ade46-7ff0.html#WS5b3ccc516d4fbf351e63e3d118666ade46-7cca

Translations:
Português do Brasil

Was this article helpful? feel free to make a donation and help keep the blog in the air
Adobe AIR

Leave a Reply