Invoking an AIR app from another AIR app

Today I was just trying to see how to launch one AIR app from another… The idea struck me when I was reading –Installing and running an AIR applications from a web page documentation on livedocs and I thought it is worth posting here.

There is an air.swf file file at [http://airdownload.adobe.com/air/browserapi/air.swf]. One can invoke a launchApplication() method on the file to interact with the AIR runtime and launch installed AIR applications from a web page in a browser. I decided to use the same file to launch AIR apps from another AIR app. To get this working, the trick is very simple:

  1. Get the applicationID and the publisherID of the app intended to be invoked

    applicationID can be obtained, either from the author of the application or looking at the application.xml file funder the META-INF/AIR folder in the application install directory.

    publisherID can be obtained, either from the author of the application or in the publisherid file under the META-INF/AIR folder in the application install directory.

  2. First load the air.swf in an instance of the Loader class and set the LoaderContext as mentioned here under “Loading the air.swf file” heading.
  3. Do a check if the application is installed using the code under “Checking from a web page if an AIR application is installed” heading.
  4. Use the following code to launch the application

    var appID:String = enter applicationID here;
    var pubID:String = enter publisherID here;
    airSWF.launchApplication(appID, pubID);
  5. Done…

Note:

This would only work if the application.xml file of the application that you want to launch has the allowBrowserInvocation property set to true.

Here is an example of 2 apps, AIRAppLauncher and AIRAppLaunched. AIRAppLauncher can be used to launch AIRAppLaunched. You will have to sign the AIRAppLaunched, export as AIR, extract the publisherID, install it and use that in AIRAppLauncher for the whole workflow to work. You can download the archive here

Advertisements

7 Responses to Invoking an AIR app from another AIR app

  1. Yeah, but I’d rather just have the ability to invoke all kinds of apps from an AIR app
    AIR and the desktop need to better friends 🙂

    Cheers,
    Mrinal

  2. Deepak MS says:

    Hi,
    i had mailed u regarding somethin few days back @ raghunath(dot)rao(at) gmail(dot)com, n i din get any response from u…. 😦

  3. raghunathrao says:

    Hey deepak… i didnt get it for some reason. Can you resend it?

  4. Deepak MS says:

    Hi,
    I have sent that email to you again. Please let me know if it has reached you…. 🙂

    tc,
    Cheers,
    Deepak

  5. usman Khan says:

    Hi,

    Have tried your example. But does not work. Publisher Id and app id are specified. Says that version not found.

    Using Vista, could that be a problem?

    Also using a self signed certificate which is installed as a trusted authority..

  6. gabriel says:

    Hi Usman Khan,

    Be sure the call to do the load is in response to user event like ‘click’… Notes the author mentions above as links to adobe (I can post a link here Due to security that will through this post away otherwise :)).

    I did get it to work with a dev certificate in this case.

    -gabriel

  7. Rahim says:

    Hi Raghu,
    nice example. I want to run an parallel child application which will update the stored data of the parent application. Is that possible using air.

    Thanks

    – Rahim

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s