我正在尝试使用ACR1281U NFC标签阅读器,在Android设备上使用示例进行主机卡模拟。
这是我想要制作的应用程序类型。
根据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应用程序?
这是我发的另一个相关问题: 未找到支持的卡终端 ARC1281U nfc卡阅读器
我已经参考了以下链接,但并没有太大帮助:
请帮忙,因为关于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设备。