gpt4 book ai didi

安卓 : How to prevent to call again selected activity again from background to foreground after the selection of the result?

转载 作者:行者123 更新时间:2023-11-30 02:24:28 25 4
gpt4 key购买 nike

我有在通话结束(挂断)后调用的 Activity 。见下图:

enter image description here

问题是在某些设备上(尤其是 LG)我能够从后台回调 Activity -> 请参见下图:

请问,我该如何拒绝这种行为?

如果 Activity 是从服务启动的,我尝试使用一些标志,但它不起作用。

我认为最好的解决方案是完全结束该 Activity 并将该 Activity 从历史记录中删除,这样用户就无法再次启动该 Activity 。

我试过这样做:

  public void closeApp() {
this.finish();
}

但这只适用于某些设备。

谁能告诉我该如何解决?

非常感谢您的帮助。

enter image description here

最佳答案

您可以尝试在您的 AndroidManifest.xml 中使用 android:excludeFromRecents

来自 doc

Whether or not the task initiated by this activity should be excluded from the list of recently used applications, the overview screen. That is, when this activity is the root activity of a new task, this attribute determines whether the task should not appear in the list of recent apps. Set "true" if the task should be excluded from the list; set "false" if it should be included. The default value is "false".

关于安卓 : How to prevent to call again selected activity again from background to foreground after the selection of the result?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28064362/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com