从另一个apk调用android apk

发布于 2024-09-17 04:59:38 字数 159 浏览 4 评论 0原文

我尝试通过引发意图从另一个 apk (BB1) 调用 android apk (AA1)。但BB1启动时在自己的进程空间中启动AA1,并且不使用AA1现有的运行进程。我怎样才能实现 一个。我希望 BB1 使用现有的 AA1(如果它已经在运行)。 b.如果尚不存在,则应将 AA1 作为独立应用程序调用。

I tried invoking an android apk (AA1) from another apk (BB1) by raising intent. But BB1 starts starts AA1 in its own process space and it does not use the existing running process of AA1. How can I achieve
a. I want BB1 to use existing AA1 if it is already running.
b. If it is not already there, it should invoke AA1 as an independent application.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

我认为通过在 Manifest.xml 中设置相同的进程 ID 就可以了。

I think by setting same process ID in Manifest.xml will work.

东风软 2024-09-24 04:59:44

a.我希望 BB1 使用现有的 AA1(如果它已经在运行)

您可以尝试让 BB1 使用 Intent.FLAG_ACTIVITY_CLEAR_TOP|Intent.FLAG_ACTIVITY_SINGLE_TOP 作为用于启动 Activity 的 Intent 上的标志AA1,尽管我只在单个应用程序中尝试过此操作,而不是在两个应用程序之间尝试过。

b.如果尚不存在,则应将 AA1 作为独立应用程序调用。

默认情况下会发生这种情况。

a. I want BB1 to use existing AA1 if it is already running

You can try having BB1 use Intent.FLAG_ACTIVITY_CLEAR_TOP|Intent.FLAG_ACTIVITY_SINGLE_TOP as flags on the Intent used to start the activity from AA1, though I have only tried this for a single app, not between two apps.

b. If it is not already there, it should invoke AA1 as an independent application.

This will happen by default.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文