Open a Native AIR app via URL?
Asked Answered
L

3

7

I'd like people to have the ability to launch a Native AIR app via URL. My AIR app would read some parameters on it and open to the correct state.

So the use case would be someone would be browsing our site, then would click on a link, and it would open the native desktop app to the correct content that's associated to their link.

I know iTunes does this, and other apps support it.

I know AIR (non-native) installer supports this too.

I don't know if I can do this with a native AIR app (.exe or .dmg install).

Edit: This is for the desktop.

Lindly answered 21/1, 2012 at 20:17 Comment(0)
A
5

Ok so this is how you do that for desktop applications.

-First of all in the application descriptor file set allowBrowserInvocation to true: true (http://livedocs.adobe.com/flex/3/html/help.html?content=File_formats_1.html#1043413)

-The application must listen to BrowserInvokeEvent at the start and then you can use the arguments passed to the application like this:

public function onInvokeEvent(invocation:InvokeEvent):void 
{
    arguments = invocation.arguments;
    currentDir = invocation.currentDirectory;
}

-You can launch an AIR APP only from an SWF. A SWF file in the browser can launch an AIR application by calling the launchApplication() method in the air.swf file loaded from http://airdownload.adobe.com/air/browserapi/air.swf Once the air.swf file is loaded, the SWF file can call the air.swf file's launchApplication() method, as in the following code:

var appID:String = "com.example.air.myTestApplication";
var pubID:String = "02D88EEED35F84C264A183921344EEA353A629FD.1";
var arguments:Array = ["launchFromBrowser"]; // Optional
airSWF.launchApplication(appID, pubID, arguments);

For more informations http://livedocs.adobe.com/flex/3/html/help.html?content=app_launch_1.html#1038008

Hope it helps.

Arjuna answered 19/3, 2012 at 15:13 Comment(0)
A
6

for iphone you should use an Url-scheme http://iosdevelopertips.com/cocoa/launching-your-own-application-via-a-custom-url-scheme.html

for android you should edit the AndroidManifest.xml like this

   <activity android:name=".MyUriActivity">
    <intent-filter>
        <action android:name="android.intent.action.VIEW" />
        <category android:name="android.intent.category.DEFAULT" />
        <category android:name="android.intent.category.BROWSABLE" />
        <data android:scheme="myapp" android:host="path" />
    </intent-filter>
   </activity>

You can find more answers here How to implement my very own URI scheme on Android

Arjuna answered 15/3, 2012 at 11:16 Comment(1)
Thanks, this is for the desktop though. I edited my question to be more clear. Thanks for taking the time to respond.Lindly
A
5

Ok so this is how you do that for desktop applications.

-First of all in the application descriptor file set allowBrowserInvocation to true: true (http://livedocs.adobe.com/flex/3/html/help.html?content=File_formats_1.html#1043413)

-The application must listen to BrowserInvokeEvent at the start and then you can use the arguments passed to the application like this:

public function onInvokeEvent(invocation:InvokeEvent):void 
{
    arguments = invocation.arguments;
    currentDir = invocation.currentDirectory;
}

-You can launch an AIR APP only from an SWF. A SWF file in the browser can launch an AIR application by calling the launchApplication() method in the air.swf file loaded from http://airdownload.adobe.com/air/browserapi/air.swf Once the air.swf file is loaded, the SWF file can call the air.swf file's launchApplication() method, as in the following code:

var appID:String = "com.example.air.myTestApplication";
var pubID:String = "02D88EEED35F84C264A183921344EEA353A629FD.1";
var arguments:Array = ["launchFromBrowser"]; // Optional
airSWF.launchApplication(appID, pubID, arguments);

For more informations http://livedocs.adobe.com/flex/3/html/help.html?content=app_launch_1.html#1038008

Hope it helps.

Arjuna answered 19/3, 2012 at 15:13 Comment(0)
E
0

Register BrowserInvokeEvent on completion, NativeApplication.nativeApplication.addEventListener(BrowserInvokeEvent.BROWSER_INVOKE,onBrowserInvoke);

then define,

protected function onBrowserInvoke(event:BrowserInvokeEvent):void { arguments = event.arguments; }

Eliga answered 28/3, 2013 at 19:44 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.