2

如何通过服务在后台读取 NFC 标签?我已经可以在活动中阅读它(我找到了一些源代码,但我并不真正了解它是如何工作的),但我找不到任何关于在服务或可运行中阅读它的信息。

感谢帮助

4

1 回答 1

1

最后我想出了如何解决它。我必须在 AndroidManifest.xml 中使用这些意图过滤器才能正确运行我的活动。

<intent-filter>
    <action android:name="android.nfc.action.TECH_DISCOVERED"/>
    <meta-data android:name="android.nfc.action.TECH_DISCOVERED" />
</intent-filter>

<intent-filter>
    <action android:name="android.nfc.action.TAG_DISCOVERED" />
    <category android:name="android.intent.category.DEFAULT" />
</intent-filter>
于 2013-01-30T14:14:23.090 回答