且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

android在不使用调度系统的情况下获取NFC标签

更新时间:2023-02-08 12:19:01

如果您运行的是 Android 4.4+,则可以使用几乎未公开的 NFC 系统阅读器模式"功能来执行此操作.每当您打开阅读器模式时,它都会在其字段中查找标签并将其传递给您的阅读器回调.这使您可以通过禁用和重新启用阅读器模式,无需物理移动即可重新获取已在现场的标签.启用阅读器模式

If you're running Android 4.4+, you can do this with almost undocumented "reader mode" feature of the NFC system. Whenever you turn on reader mode it will look for a tag in its field and pass it to your reader callback. This lets you reacquire a tag that is already in the field without physical movement by disabling and reenabling reader mode. Enabling reader mode