Should NfcAdapter.enableReaderMode in foreground Activity override the intent tag dispatch system?

 ̄綄美尐妖づ 提交于 2020-04-16 04:21:45

问题


In Android 10 I noticed I get a Toast message from the OS stating "No supported application for this NFC tag" or "No supported app for this NFC tag" (depending on the device):

The weird thing is that I see the Toast while enableReaderMode is active in the foreground Activity. In all previous versions of Android, enableReaderMode would override the Android intent tag dispatch system. Is this a bug in Android 10?

I know enableForegroundDispatch also exists, and that API does seem to override the intent tag dispatch system even in Android 10. But I'd like to keep control over the NFC discovery sound which is only provided by enableReaderMode.

I also know that I can declare an intent-filter in my manifest to get rid of the Toast while continuing to use enableReaderMode, but that also has unintended side effects (e.g. my app could be launched while reading the NFC tag from the device home screen which I don't want).

来源:https://stackoverflow.com/questions/60868912/should-nfcadapter-enablereadermode-in-foreground-activity-override-the-intent-ta

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!