Android NFC:当APDU命令发送到智能卡时,标签丢失 [英] Android NFC : Tag lost when APDU command sent to a smart card
问题描述
我正在Android OS(三星Galaxy)上做一个EMV应用程序.
I am doing an EMV application on Android OS (Samsung Galaxy).
我能够毫无问题地发送多个APDU命令,但是当我尝试发送内部身份验证命令时.我有此错误:标记丢失.您对此错误的目的有任何想法吗?我不是在Android上经过实验的开发人员,可能我忘记了一些东西.
I am able to send several APDU commands without problem but when I am trying to send the internal authentication command. I have this error : Tag lost. Have you got any idea concerning the purpose of this error ? I am not an experimented developer on Android, It may I have forgotten some stuff.
- 命令正确.
- 我可以用另一个命令代替,它可以工作(我的意思是我可以恢复响应).
在哪种情况下,可以在Android上中断NFC通信?
In which cases a NFC communication can be broken on Android?
在这里,发送命令时您会看到我的问题:
Here, you can see my problem when the command is sent :
D/ECInfoGrabber(14088):发送:00 88 00 00 04 14 16 67 3D
D/OpenGLRenderer(14088):刷新缓存(模式0)D/dalvikvm(14088):GC_FOR_ALLOC释放227K,4%释放14298K/14855K,暂停29ms I/dalvikvm-heap(14088):将堆(片段大小写)增加到14.142MB 115216字节分配D/dalvikvm(14088):GC_FOR_ALLOC释放了3K,4% 免费14408K/14983K,暂停15ms
D/ECInfoGrabber(14088): Send: 00 88 00 00 04 14 16 67 3D
D/OpenGLRenderer(14088): Flushing caches (mode 0) D/dalvikvm(14088): GC_FOR_ALLOC freed 227K, 4% free 14298K/14855K, paused 29ms I/dalvikvm-heap(14088): Grow heap (frag case) to 14.142MB for 115216-byte allocation D/dalvikvm(14088): GC_FOR_ALLOC freed 3K, 4% free 14408K/14983K, paused 15ms
谢谢
推荐答案
一种可能性是,卡的响应所花费的时间比默认超时设置要长.当卡必须进行一些内部计算时,通常会发生这种情况.通常在进行身份验证之类的加密操作的情况下.
One possibility is that the response from the card takes more time than the default time-out setting. This often occurs when the card has to do some internal calculations; typically in case of cryptographic operations such as authentication.
您可以使用 IsoDep.setTimeout()
:
You can change the time-out value using IsoDep.setTimeout()
:
IsoDep iso = IsoDep.get(tag);
iso.connect();
iso.setTimeOut(5000); // 5 sec time out
iso.transceive(apduCommand); // now send your command
这篇关于Android NFC:当APDU命令发送到智能卡时,标签丢失的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!