怎么不显示的选项列表中打开一个意图,如果一个是机器人已经打开意图、机器人、选项、列表中

2023-09-04 06:54:31 作者:七分相思三分泪

我显示我在时可用其触发获得NFC标签选项列表中的应用程序。 我不希望显示的选项,如果我的应用程序已经打开。 可能吗?怎么样?

I am showing my application in list of options available to get NFC tag when its trigger. I don't want to show the options if my application is already open. Is it possible? and how?

推荐答案

当您希望收到NFC的意图,而你的应用程序是在前台,您应该注册你的活动为前台调度系统。这样一来,你的活动获得precedence通过该登记在他们的应用程序清单相同的标签类型的其他应用程序。因此,当你活性的研究是在foregorund,没有任何活动选择器将显示,即使其他应用程序也有意图过滤器这些事件。

When you want to receive NFC intents while your app is in the foreground, you should register your activity for the foreground dispatch system. That way, your activity gets precedence over other apps that registered for the same tag type in their app manifest. Thus, while your acitivity is in the foregorund, no activity chooser will be shown even if another app also has intent filters for these events.