问题
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