简体   繁体   English

Adobe Flex Mobile 4.6-从浏览器启动应用程序

[英]Adobe Flex Mobile 4.6 - Launching app from browser

I'm trying to start development on a Flex Mobile app that my company is developing in Adobe AIR (using Flash Builder). 我正在尝试在我的公司正在Adobe AIR(使用Flash Builder)中开发的Flex Mobile应用程序上开始开发。 The app will initially be released for iPhone and Android, and eventually BlackBerry PlayBook tablets as well. 该应用程序最初将在iPhone和Android以及BlackBerry PlayBook平板电脑上发布。

However, one of the requirements is that we need to be able to launch the app from the browser on the device, and pass a parameter into it. 但是,要求之一是我们需要能够从设备上的浏览器启动应用程序,并将参数传递给它。

I'm not sure what I am doing wrong, but I can't get this to work. 我不确定自己在做什么错,但是我无法使它正常工作。 I've put the following block of code in the Android section. 我将以下代码块放入Android部分。 I'm just working with Android for the moment, for initial testing. 目前,我正使用Android进行初始测试。 Its easy to drop an APK onto an Android device, and I've got one sitting right here. 将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>

I've also got this code for handling the event: 我还获得了用于处理事件的以下代码:

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;
        }

The allowBrowserInvocation flag is set to true. 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. 我尝试使用以下链接创建测试HTML页面,但在Android浏览器中仅收到“网页不可用”消息。

<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? 如何通过在Android OS中的浏览器中调用URL来注册一些URL名称空间(myapp://app.start/)来访问您的程序?

How to implement my very own URI scheme on Android 如何在Android上实现我自己的URI方案

Open a Native AIR app via URL? 通过URL打开本机AIR应用程序?

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 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) (从注释移到实际答案,现在StackOverflow允许我这样做)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM