问题描述
我正在 Android OS (Samsung 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): 刷新缓存 (mode 0) D/dalvikvm(14088): GC_FOR_ALLOC freed 227K, 4% free 14298K/14855K, paused 29msI/dalvikvm-heap(14088):将堆(碎片情况)增加到 14.142MB115216 字节分配 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 命令发送到智能卡时标签丢失的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!