Android NFC 手机可以充当 NFC 标签吗?
据我目前的了解,NFC 手机将充当 NFC 读取器,从 NFC 标签读取数据。现在我的问题是,我们可以改变这一点吗?我们能否让 Android NFC 手机充当 NFC 读取器从中获取数据的标签?
感谢您的帮助。
From what I have understood so far, an NFC phone will act as an NFC reader which will read data from an NFC tag. Now my question is, can we switch this around? Can we make an Android NFC phone behave as the tag which an NFC reader will get data from?
Thanks for your assistance.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(12)
此时,我会回答“否”或“有困难”,但随着 Android NFC API 的发展,这种情况可能会随着时间而改变。
NFC 交互共有三种模式:
读写器:手机读取标签并写入标签。它不是模拟卡,而是模拟 NFC 读取器/写入器设备。因此,您无法在此模式下模拟标签。
点对点:手机可以读取并传回ndef消息。如果标签阅读器支持点对点模式,那么手机就可以充当标签。但是,我不确定 android 是否在 LLCP 协议(NFC 逻辑链路协议)之上使用自己的协议,这会阻止大多数读者将手机视为 nfc 标签。
卡模拟模式:手机使用安全元件来模拟智能卡或其他非接触式设备。我不确定这是否已经启动,但可能会带来希望。但是,使用安全元素可能需要硬件供应商或其他人验证您的应用程序/授予其访问安全元素的权限。它并不像创建常规 NFC Android 应用程序那么简单。
更多详细信息请参见此处:
http://www.mail-archive.com/[email protected]/msg152222.html
一个真正的问题是:你为什么要模仿一个简单的旧NFC标签?有什么我没有想到的应用程序吗?通常,您想要模拟交通卡、访问密钥或信用卡等需要安全元素的东西(我认为,但不确定)。
At this time, I would answer "no" or "with difficulty", but that could change over time as the android NFC API evolves.
There are three modes of NFC interaction:
Reader-Writer: The phone reads tags and writes to them. It's not emulating a card instead an NFC reader/writer device. Hence, you can't emulate a tag in this mode.
Peer-to-peer: the phone can read and pass back ndef messages. If the tag reader supports peer-to-peer mode, then the phone could possibly act as a tag. However, I'm not sure if android uses its own protocol on top of the LLCP protocol (NFC logical link protocol), which would then prevent most readers from treating the phone as an nfc tag.
Card-emulation mode: the phone uses a secure element to emulate a smart card or other contactless device. I am not sure if this is launched yet, but could provide promising. However, using the secure element might require the hardware vendor or some other person to verify your app / give it permissions to access the secure element. It's not as simple as creating a regular NFC android app.
More details here:
http://www.mail-archive.com/[email protected]/msg152222.html
A real question would be: why are you trying to emulate a simple old nfc tag? Is there some application I'm not thinking of? Usually, you'd want to emulate something like a transit card, access key, or credit card which would require a secure element (I think, but not sure).
Nexus S 支持点对点模式,即它的名字暗示,使一部手机充当另一部手机可以读取的标签。这是一次非常精彩的 Google I/O 会议 今年的 NFC。如果您对 NFC 感兴趣,我建议您观看它。
The Nexus S supports peer-to-peer mode, which as its name implies, causes one phone to act as a tag which another phone can read. There was a really good Google I/O session on NFC this year. I would recommended watching it if you're at all interested in NFC.
检查 Android 4.4 中可用的基于主机的卡模拟 (HCE) NFC 模式。
API 指南:https://developer.android.com/guide/topics/connectivity/nfc/hce .html
Check the Host-based Card Emulation (HCE) NFC mode available in Android 4.4.
API guide: https://developer.android.com/guide/topics/connectivity/nfc/hce.html
是的,你可以。 Android kitkat 在此处增强了此功能
yes you can. Android kitkat boosts of this functionality here
可以让 Android 设备充当 NFC 标签。这种行为称为卡模拟。
路由表指示 NFC 控制器将读取器的命令路由到何处。
Its possible to make Android device behave as an NFC Tag. Such a behaviour is called Card Emulation.
A routing table instructs the NFC controller where route the Reader's commands to.
是的,看看 NFCManager 中的 NDEF Push - 使用 Android 4,您现在甚至可以创建 NDEFMessage 以在交互发生时推送到活动设备。
Yes, take a look at NDEF Push in NFCManager - with Android 4 you can now even create the NDEFMessage to push to the active device at the time the interaction takes place.
请阅读此处:http://groups.google.com/group/android-developers/browse_thread/thread/d5fc35a9f16aa467/dec4843abd73d9e9%3Flnk%3Dgst%26q%3Dsecure%2Belement%2Bdiff%2527s%23dec4843abd73d9e9?pli=1< /a>
我自己还没有证实这一点,但看起来人们设法再次将隐藏代码包含到 Android 中。
他们似乎能够模拟 Mifare Classic 卡 (iso-14443)。
我很快就会亲自测试一下,它看起来很有趣。
如果您想为商业/免费应用程序执行此操作,您将遇到困难,您的用户不会喜欢更改其内核来支持您的应用程序。
更新:
有一个简单的技巧可以让您的手机模拟票证:
您可以获取 NFC 贴纸并将其放入手机中或手机上。这样您就可以随时读取和写入它,其他设备也可以读取和写入它。
这只是我的一个想法,当然从未见过在任何地方使用过;)
Read here: http://groups.google.com/group/android-developers/browse_thread/thread/d5fc35a9f16aa467/dec4843abd73d9e9%3Flnk%3Dgst%26q%3Dsecure%2Belement%2Bdiff%2527s%23dec4843abd73d9e9?pli=1
I've not verified that myself but it looks like people managed to include the hidden code into Android again.
They seem to be able to emulate a Mifare Classic card (iso-14443).
I'll soon test this myself, it looks very interesting.
If you want to do it for a commercial/free app you'll have a hard time, your users won't like to change their kernel to support your app.
Update:
There would be a simple trick to make your phone emulate a ticket:
You can get a NFC-sticker and put it in or on the phone. This way you are able to read and write it at all times and other devices can also read and write it.
It's just an idea I had, never seen that used anywhere of course ;)
在关于 NFC 的 google io 会议中,qa 部分。有这样一个问题:
In the google io session about NFC, qa section. There was such a question:
如果您的意思是让一个通电的 NFC 设备假装成无源设备(例如标签).. 不确定它的工作效果如何,但 android 应用程序 NFCClassic 声称可以记录标签内容,然后允许激活标签并显示为将复制的标签复制到 NFC 读取器。创建记录标签库。
If you mean getting a powered NFC device to pretend to be a passive one (eg a tag).. not sure how well it works but the android app NFCClassic purports to record tag contents and then allow the tag to be activated and appear to be the copied tag to NFC readers. Creates a library of recorded tags.
不,目前还不行。谷歌在Google IO 2011上指出,不支持并且暂时不会支持卡模拟。主要(且易于理解)问题:哪个应用程序应该在手机上获得模拟智能卡的权限?
No, not at the moment. Google pointed out at the Google IO 2011, that card emulation is not supported and won't be supported for a while. Main (and easy to understand) problem: Which App should get the right on the phone to emulate a smartcard?
您绝对可以使用点对点支持中的 NDEFPush 功能使 Android 手机写入标签读取器 - 但您需要在标签读取器端编写代码才能使用点对点 (llcp) 。
You can definitely make an Android phone write to a tag reader using the NDEFPush functionality in the peer-to-peer support - but you will need to write the code on the tag reader side to use peer-to-peer as well (llcp).
是的,您可以,这就是点对点模式
点对点模式
– 接近触发交互
– Nexus S:设备必须背对背放置
交换电子卡 –
门票和门票的移交P2P支付
——网页共享、Youtube视频共享——
应用程序共享
Yes you can which is Peer-To-Peer Mode
Peer-To-Peer Mode
–Proximity triggered interactions
–Nexus S: Devices have to be placed back-to-back
–Exchange of vCards
–Hand-over of Tickets & P2P Payment
–Web-page sharing, Youtube-video-sharing
–Application sharing