1

我正在尝试开始开发我的公司在 Adob​​e AIR 中开发的 Flex Mobile 应用程序(使用 Flash Builder)。该应用程序最初将针对 iPhone 和 Android 发布,最终还将针对 BlackBerry PlayBook 平板电脑发布。

但是,其中一个要求是我们需要能够从设备上的浏览器启动应用程序,并将参数传递给它。

我不确定我做错了什么,但我无法让它发挥作用。我已将以下代码块放在 Android 部分。我目前只是在使用 Android 进行初步测试。将 APK 放到 Android 设备上很容易,我这里有一个。

            <application>
                <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> 
            </application>

我也有处理事件的代码:

import mx.events.FlexEvent;

        protected function application_preinitializeHandler(event:FlexEvent):void
        {
            NativeApplication.nativeApplication.addEventListener(
                InvokeEvent.INVOKE, onInvoke);
        }

        private function onInvoke(event:InvokeEvent):void
        {
            // You can parse argument value from event.arguments property
            Text1.text = "Arguments: " + event.arguments;
        }

allowBrowserInvocation 标志设置为 true。

I tried creating a test HTML page with the following links, but I just get a "Webpage not available" message in the Android browser.

<a href="myapp:">myapp:</a>

<br><br>

<a href="myapp:#Intent;action=android.intent.action.view;end">click to load apk</a>

I've read all of the following posts, but I'm still having trouble. Can someone please help me out? What am I missing?

How to register some URL namespace (myapp://app.start/) for accessing your program by calling a URL in browser in Android OS?

How to implement my very own URI scheme on Android

Open a Native AIR app via URL?

4

1 回答 1

1

Okay...I'm not sure what I did, maybe the break I took for a glass of water helped. But when I just tried it again, it works.

I cleared out the manifest section, and tried again, with the example from this site:

http://dreamingwell.com/articles/archives/2011/06/flex-mobile-cus-2.php

And now it works...but I thought I tried that already...

(Moved from comments to an actual answer, now that StackOverflow is allowing me to do so)

于 2012-06-08T14:11:17.870 回答