简体   繁体   中英

Android NFC : Tag lost when APDU command sent to a smart card

I am doing an EMV application on Android OS (Samsung Galaxy).

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.

  • the command is correct.
  • I can replace by another command, it works (I mean I can recover a response).

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): 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

Thanks

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.

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 

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM