Android Nfc 示例演示 - 仅从标签读取虚假信息
我刚刚从 google 安装了 Nfc 演示,但它没有读取标签中的信息。->它只是提供一些 fakeTag 信息。有人知道我可以在哪里更改示例以从 nfc 标签读取吗?或者有人有 Nexus 的可用 NFC 演示吗?
如果我们可以将 nfc 演示带到工作中,那么许多人就有可能自己开发一个 nfc 演示。
此致 亚历山大
I just installed the Nfc Demo from google, but it doesn´t read the information from the Tag.-> It just provides some fakeTag information. Has anybody an idea, where I can change the sample to read from the nfc Tag? Or has somebody a working nfc demo for the nexus?
If we could bring a nfc demo to work, many people would have the possibility to develop a nfc demo on their own.
Best regards
Alexander
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
我在获取标签 ID 时遇到了同样的问题。我屏幕上显示了一些 B@2346323143 样式的数据。我让它像这样工作:
byte[] byte_id =intent.getByteArrayExtra(NfcAdapter.EXTRA_ID);
您需要将 byte[] 转换为十六进制字符串。例如使用以下方法。
I had the same problem getting tag id. I got some B@2346323143 style data to screen. I got it to work like this:
byte[] byte_id = intent.getByteArrayExtra(NfcAdapter.EXTRA_ID);
You need to convert byte[] to hex string. For example using following method.
NfcDemo 有两个部分。有检测器活动,它响应 NFC 标签意图,然后有 FakeTag 活动,它允许您向第一部分发送假标签意图。但只要启用了 NFC,第一部分也会检测真正的 NFC 标签。检查“设置”->“无线查看 NFC 是否已打开。如果是,并且您安装了 NfcDemo,您应该能够检测到 NFC 标签。但是,NfcDemo 仅配置为检测 NDEF 标签,因此如果您有其他类型的 NFC 标签(例如 Mifare Classic),您将需要获取另一个应用程序,或者修改 NfcDemo 以处理其他 NFC 标签类型。
There are two parts to the NfcDemo. There is the detector activity, which responds to NFC tag intents, then there is the FakeTag activity which allows you to send fake tag intents to the first part. But the first part will detect real NFC tags too, as long as NFC is enabled. Check under Settings -> Wireless to see if NFC is turned on. If it is and you have the NfcDemo installed, you should be able to detect NFC tags. However, the NfcDemo is only configured to detect NDEF tags, so if you have some other type of NFC tag (e.g., Mifare Classic), you'll either need to get another app, or modify NfcDemo to handle the other NFC tag types.
我编写了一个具有一些基本 NFC 功能的类,希望它可以帮助其他人获得读取某些 NFC 标签的解决方案。
I have written a class with some basic NFC function, hopefully it helps someone else to get a solution of reading some NFC Tag.
我为 Android 上的 NFC 编写了一些工具,其中包括一个可用的示例项目供阅读并编写真实的标签。我还做了一个简单的重写您可能感兴趣的 NFCDemo 项目的 。
我还向 NFC Developer 应用程序,以便更多人可以使用 NFC,即无需 NFC 设备。
I've written some tools for NFC on Android, including a working example project for reading and writing real tags. I've also done a simple rewrite of the NFCDemo project you might be interested in.
I've also added broadcast send / receive capability to the NFC Developer app so that more people can play with NFC, i.e. without needing an NFC device.