gpt4 book ai didi

java - 如何确保我的应用程序不与其他使用 nfc 的应用程序冲突

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

我有一个应用程序可以使用 Mifare 经典 1K nfc 芯片登录。我们的客户使用另一个具有相同功能的应用程序 (nedap),但使用不同的卡(虽然类型相同)。如果两个应用程序都打开并且我的应用程序在前台,他们可以使用我们的 nfc 标签登录。但是,当另一个应用程序位于前台并且他们尝试使用另一个 nfc 芯片登录时,该应用程序拒绝登录(它只是卡在登录屏幕上而没有错误)。如果只打开一个应用程序,则完全没有问题。
这是我的错还是其他应用程序的错误?如果是我的错,我怎样才能确保在实现 nfc 功能时不会搞砸其他应用程序?

最佳答案

如果使用 foreground dispatch system 启动应用程序,只有这个应用程序处理 NFC 流量:

The foreground dispatch system allows an activity to intercept an intent and claim priority over other activities that handle the same intent.

当您的应用进入后台时,您必须将其禁用:

Also, activities must call disableForegroundDispatch(Activity) before the completion of their onPause() callback to disable foreground dispatch after it has been enabled.

关于java - 如何确保我的应用程序不与其他使用 nfc 的应用程序冲突,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22019333/

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