android在不使用调度系统的情况下获取NFC标签 [英] android get NFC tag without using dispatch system

查看:89
本文介绍了android在不使用调度系统的情况下获取NFC标签的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想获得一些帮助来实现以下场景:

I want to get some help for implementing the following scenario:

nfc 标签粘在我的安卓手机背面,我想用它写一个 I/O 程序.

the nfc tag is glued to the back of my android phone, and I want to write a program to I/O with it.

到目前为止,我知道获取 Tag 对象的唯一方法是通过调度系统,这需要将标签移近手机才能触发检测.

So far the only way I knew about obtaining a Tag object is through dispatch system, which requires the tag to be move close to the phone to trigger detection.

有没有办法不依赖调度系统的意图来获取标签?所以我可以在 UI 上放一个按钮,每当它被点击时,它就会使用标签执行 I/O?

Is there a way to obtain the Tag without relying on the intent from dispatch system? So I can just put an button on the UI, and whenever its clicked it would perform I/O with the tag?

谢谢!

推荐答案

如果您运行的是 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

这篇关于android在不使用调度系统的情况下获取NFC标签的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆