Android : 如何防止在选择结果后再次从后台调用再次选择activity到前台?

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

我有activity,在通话结束(挂断)后被调用。见下图:

问题是在某些设备上(尤其是 LG)我可以从后台调用 activity -> 见下图:

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

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

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

我试过这样做:

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

但这只适用于某些设备。

有人可以告诉我我该如何解决吗?

非常感谢您的帮助。

您可以尝试在 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".