【发布时间】:2015-01-10 14:39:32
【问题描述】:
我正在尝试使用 ACR1281U NFC 标签阅读器在 Android 设备上使用 example 执行 Host card emulation。
This 是我想做的那种应用程序。
根据Android文档和示例,需要在Android项目中注册一个AID:
<host-apdu-service xmlns:android="http://schemas.android.com/apk/res/android"
android:description="@string/servicedesc"
android:requireDeviceUnlock="false">
<aid-group android:description="@string/aiddescription"
android:category="other">
<aid-filter android:name="F0010203040506"/>
<aid-filter android:name="F0394148148100"/>
</aid-group>
</host-apdu-service>
我如何知道我需要在我的 Android 应用程序中注册哪个 AID,以便阅读器可以阅读 HCE Android 应用程序?
这是我发布的另一个问题:No supported card terminal found ARC1281U nfc card reader
我参考了以下链接,但没有太大帮助:
- Setting up host card emulation
- To get Application ID for NFC based Identification System
- How does Host-based Card Emulation deal with AID (Application ID)?
- Android HCE: are there rules for AID?
请帮忙,因为 HCE 上可用的资源很少!
编辑
该示例在 SELECT(通过 AID)命令中使用了 AID F0010203040506,但我的 ACR128 阅读器无法读取 HCE 设备。
private static final byte[] CLA_INS_P1_P2 = { 0x00, (byte)0xA4, 0x04, 0x00 };
private static final byte[] AID_ANDROID = { (byte)0xF0, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06 };
private byte[] createSelectAidApdu(byte[] aid) {
byte[] result = new byte[6 + aid.length];
System.arraycopy(CLA_INS_P1_P2, 0, result, 0, CLA_INS_P1_P2.length);
result[4] = (byte)aid.length;
System.arraycopy(aid, 0, result, 5, aid.length);
result[result.length - 1] = 0;
return result;
}
然后我将 AID 更改为 F00000000A0101(其他示例应用程序使用过),并在 AID 过滤器中也使用了它。更改为此 AID 后,ACR 阅读器能够检测到 HCE 设备。
【问题讨论】: