从空气中“新窗口”打开另一个Android应用 [英] opening another Android app in a 'new window' from Air

查看:221
本文介绍了从空气中“新窗口”打开另一个Android应用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这是一个的的参与,所以多多包涵。

我有两个Android应用程序 - ('目标'的)一个建在Adobe AIR(以下简称发射器),一个来自谷歌Play商店下载在某一点上,我想'启动'打开目标,并切换到它。目前,我通过'意图'协议这样做,像这样:

  navigateToURL(新URLRequest('intent:#Intent;action=android.intent.action.MAIN;category=android.intent.category.LAUNCHER;component=com.magix.camera_mx/com.magix.android.cameramx.main.MainMenu;end'));
 

...和它的作品,但是当目标(CameraMX在这个例子中)打开时,它使用相同的窗口的启动器的应用程序。这里有两个截图,前后开后'的目标:

这是不方便,但我可以用它忍受,如果它是一致的。但是,当我尝试完全相同的过程中,只有发动的任意其他应用程序像金山办事处:

  navigateToURL(新URLRequest('intent:#Intent;action=android.intent.action.MAIN;category=android.intent.category.LAUNCHER;component=cn.wps.moffice_eng/cn.wps.moffice.documentmanager.$p$pStartActivity;end'));
 

目标和启动存在不错的单独的窗口。

这是为什么?是什么决定一个应用程序是否出现作为一个独立的窗口,或重新使用当前的?我已经尝试过了一把 - 尤其是SoulCraft和Starchart推出一个新的窗口,但大多其余均重用当前窗口

那是我的东西从我的AIR应用程序可以控制?这是怎么回事吗?

解决方案

你调用一个窗口什么是指在Android作为一个任务。你应该能够迫使目标应用程序在新任务通过设置适当的标志的,即 FLAG_ACTIVITY_NEW_TASK (注意 launchFlags = 0x10000000处):

<$p$p><$c$c>intent:#Intent;action=android.intent.action.MAIN;category=android.intent.category.LAUNCHER;launchFlags=0x10000000;component=<your-package-name>/.<your-activity-name>;end

This is a little involved, so bear with me.

I've got two Android apps - one built in Adobe Air (the 'launcher') and one downloaded from the google play store (the 'target.') At a certain point I want the 'launcher' to open the 'target' and switch to it. Currently I'm doing this via the 'intent' protocol, like so:

navigateToURL(new URLRequest('intent:#Intent;action=android.intent.action.MAIN;category=android.intent.category.LAUNCHER;component=com.magix.camera_mx/com.magix.android.cameramx.main.MainMenu;end'));

... and it works, but when the 'target' (CameraMX in this example) opens, it uses the same 'window' as the 'launcher' app. Here's two screenshots, before and after opening the 'target:'

That's inconvenient, but I could put up with it if it was consistent. However, when I try the exact same process, only launching an arbitrary other app like Kingsoft Office:

navigateToURL(new URLRequest('intent:#Intent;action=android.intent.action.MAIN;category=android.intent.category.LAUNCHER;component=cn.wps.moffice_eng/cn.wps.moffice.documentmanager.PreStartActivity;end'));

The 'target' and 'launcher' exist as nice separate windows.

Why is that? What dictates whether an app comes up as a separate window, or reuses the current one? I've tried it with a handful - notably SoulCraft and Starchart launch in a new windows, but mostly the others all reuse the current window.

Is that something I have control over from within my air app? What's going on here?

解决方案

What you're calling a "window" is referred to in Android as a "task". You should be able to force the target application to open in a new task by setting appropriate flags, namely FLAG_ACTIVITY_NEW_TASK (note the launchFlags=0x10000000):

intent:#Intent;action=android.intent.action.MAIN;category=android.intent.category.LAUNCHER;launchFlags=0x10000000;component=<your-package-name>/.<your-activity-name>;end

这篇关于从空气中“新窗口”打开另一个Android应用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆