主机卡仿真的Andr​​oid上使用的Nexus 5 [英] Host card emulation on Android with Nexus 5

查看:337
本文介绍了主机卡仿真的Andr​​oid上使用的Nexus 5的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图按照这个文件,但我的服务是永远不会调用。 我应该关闭的Andr​​oid梁?

I'm trying to emulate an NFC tag with my Nexus 5 according to this document, but my service is never invoke. Should I turn off Android beam?

我想效仿包含URL一个简单的标签。

I'd like to emulate a simple tag containing a url.

该阅读器是一台Nexus 7(2012年),我已经想通了,这个过程就像一个NFC标签的一个简单的扫描采用了Android横梁上的Nexus 7。

The reader is a Nexus 7 (2012) and I've figured out the process like a simple scan of a NFC tag using Android beam on Nexus 7.

另外,我有点困惑援助过滤器名称。是否有它们的列表?

In addition I'm a bit confused about aid-filter name. Is there a list of them?

我敢肯定,我不明白的东西。 谢谢

I'm sure that I don't understand something. Thanks

推荐答案

首先(尽管这并不直接回答你的问题)时,preferred办法两款Android NFC设备之间传输的URL是使用Android光束(对等模式)。 Android的HCE(主机卡仿真)通常用于仿真的接触式智能卡的应用程序的比其他的NFC标签。

First of all (though this does not directly answer your question), the preferred way to transfer a URL between two Android NFC device is to use Android Beam (peer-to-peer mode). Android HCE (Host Card Emulation) is typically intended for emulation of contactless smartcard applications other than NFC tags.

我是否需要关闭Android的光束,以采用Android HCE?

没有,Android的HCE不是由Android的光束的开/关设置的影响。实际上,即使光束被关断一个机器人NFC设备仍将执行对等体的对等模式链路激活

No, Android HCE is not influenced by the on/off setting of Android Beam. Actually, even if Beam is turned off an Android NFC device will still perform peer-to-peer mode link activation.

我想效仿包含一个URL一个简单的标签。

Android的HCE模拟基于ISO / IEC 14443-4和ISO / IEC 7816-4智能卡应用。因此,如果你想模仿这一NFC标签,你就需要实现NFC论坛的第4类标签的操作规范在你的Andr​​oid HCE服务。 NFC论坛的规格是免费提供的网站

Android HCE emulates smartcard applications based on ISO/IEC 14443-4 and ISO/IEC 7816-4. Thus, if you want to emulate an NFC tag with this, you would need to implement the NFC Forum's Type 4 Tag Operation specification in your Android HCE service. The NFC Forum's specifications are freely available on their website.

要总结本规范的要求:

  1. 您需要注册服务的NFC论坛4类标签的应用AID: D2760000850101
  2. 您服务需要与状态code成功(<$ C C $> 0×9000 )到SELECT(由DF名)APDU的援助回应:

  1. You need to register your service for the NFC Forum Type 4 tag application AID: D2760000850101.
  2. Your service needs to respond with status code success (0x9000) to a SELECT (by DF name) APDU for that AID:

> 00 A4 04 00 07 D2760000850101 00
< 9000

  • 您服务需要与状态code成功的SELECT(由EF ID)响应APDU的能力容器(CC)文件(E103 <$ C C $> ):

  • Your service needs to respond with status code success to a SELECT (by EF ID) APDU for the capability container (CC) file (E103):

    > 00 A4 00 0C 02 E103
    < 9000
    

  • 您服务需要回应的CC(或它的一部分)在接收到READ BINARY APDU(将CC文件已被选中):

  • Your service needs to responds with the CC (or parts of it) upon receiving a READ BINARY APDU (after the CC file had been selected):

    > 00 B0 Offset_High Offset_Low Length
    < <Length bytes of the CC starting at Offset> 9000
    

  • 您服务需要与状态code成功的SELECT(由EF ID)响应APDU的NDEF文件(EF ID如CC定义):

  • Your service needs to respond with status code success to a SELECT (by EF ID) APDU for the NDEF file (EF ID as defined in the CC):

    > 00 A4 00 0C 02 <EF ID>
    < 9000
    

  • 您服务需要响应的NDEF文件的内容(或它的一部分)在接收到READ BINARY APDU(后NDEF文件已被选中):

  • Your service needs to responds with the NDEF file content (or parts of it) upon receiving a READ BINARY APDU (after the NDEF file had been selected):

    > 00 B0 Offset_High Offset_Low Length
    < <Length bytes of the NDEF file starting at Offset> 9000
    

  • 我想第二的Andr​​oid设备的自动的拿起URL。

    I want a second Android device to automatically pick up the URL.

    这就是问题的一部分,为什么梁是preferred的路要走的原因。即使你效仿的NFC论坛4类标签有一个Android设备,将两款Android设备连接在一起仍然会导致他们建立一个对​​等的链接(即使梁被关闭!)。因此,第二Android设备将无法检测到您的HCE模拟卡作为NFC标签。克服这种限制的唯一方法就是使用NFC读写器模式API(新的Andr​​oid 4.4系统),第二个设备上。然而,在这种情况下,你就需要有接收设备是活跃在前台(这是唯一的办法,以使读者模式API)上的应用程序。

    That's the problematic part and the reason why Beam is the preferred way to go. Even if you emulate an NFC Forum Type 4 tag with one Android device, putting two Android devices together will still result in them establishing a peer-to-peer link (even if Beam is turned off!). Thus, the second Android device will not detect your HCE emulated card as an NFC tag. The only way to overcome this limitation is to use the NFC Reader mode API (new in Android 4.4) on the second device. However, in that case, you would need to have an app on the receiving device that is active in the foreground (that's the only way to enable the Reader mode API).

    这篇关于主机卡仿真的Andr​​oid上使用的Nexus 5的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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