0

有没有办法在 Air 中从另一个应用程序打开一个应用程序?示例:我打开应用程序 A,其中包含一个按钮,单击该按钮可打开应用程序 B。假设 A 和 B 都是安装在设备中的独立应用程序,并且该设备可以是 PlayBook、Ipad 或 Android 平板电脑。

谢谢。

4

2 回答 2

1

您必须走 Air Native Extension (ANE) 路线。要么为 iOS 和 Android 分别创建一个 ANE 解决方案,要么创建一个将功能抽象到一个解决方案中的 ANE。如何在 Android 上从应用 B 启动应用 A 与在 iOS 上不同。在 SO 中看到这个答案。

要在 Android 上实现它,您需要将原生 Android Java 解决方案包装在 ANE 中。本机 Java 代码使用应用 B 的包名从应用 A 启动应用 B:

Intent intent = getPackageManager().getLaunchIntentForPackage("com.yourdoman.yourapp");
startActivity(intent);

这是有关如何通过 ANE 启动 Activity的视频教程,您可以在此基础上创建 ANE。您必须定制解决方案以按域而不是 Activity 启动。

于 2012-05-08T05:58:57.890 回答
0

因为我真的不知道你想要做什么的细节,我想我应该在这里指出你:http ://www.riaspace.com/2011/08/defining-custom-url-schemes-for-your -air-mobile-applications/ 这是我所知道的问题的最佳答案。

        private function getHostName() : void
        {
            if (NativeProcess.isSupported)
            {
                var OS : String = Capabilities.os.toLocaleLowerCase();
                var file : File;

                if (OS.indexOf('win') > -1)
                {
                    // Executable in windows
                    file = new File('C:\\Windows\\System32\\hostname.exe');
                }
                else if (OS.indexOf('mac') > -1 )
                {
                    // Executable in mac
                }
                else if (OS.indexOf('linux'))
                {
                    // Executable in linux
                }

                var nativeProcessStartupInfo : NativeProcessStartupInfo = new NativeProcessStartupInfo();
                nativeProcessStartupInfo.executable = file;

                var process : NativeProcess = new NativeProcess();
                process.addEventListener(NativeProcessExitEvent.EXIT, onExitError);
                process.addEventListener(ProgressEvent.STANDARD_OUTPUT_DATA, onOutput);
                process.start(nativeProcessStartupInfo);
                process.closeInput();
            }
        }

        private function onOutput(event : ProgressEvent) : void
        {
            var strHelper : StringHelper = new StringHelper();
            formStationID.text = event.target.standardOutput.readUTFBytes(event.target.standardOutput.bytesAvailable);
            formStationID.text = strHelper.trimBack(formStationID.text, "\n");
            formStationID.text = strHelper.trimBack(formStationID.text, "\r");
        }

此代码获取工作站名称。我听说这可以在 IOS 和 Android 上完成,但我还没有找到任何证据。

于 2012-05-07T20:20:25.760 回答