Read NfcA tag throw android.nfc.TagLostException: Tag was lost. exception -


i'm trying read nfca tag in application. code below. referred here , connected questions transceive commands, i'm keep getting android.nfc.taglostexception: tag lost. exception.

im using samsung galaxy s4 debugging.

is there possibility card not valid card or security shield can cause exception?

nfca mifare = nfca.get(tag); // tag "tag: tech [android.nfc.tech.nfca]" if (mifare != null){   try {     mifare.connect();     mifare.settimeout(5000);     if (mifare.isconnected()) {       int firstblocknum = 0;       int lastblocknum = 42;       byte[] command = new byte[]{                         (byte)0x3a,  // fast_read                         (byte)(firstblocknum & 0x0ff),                         (byte)(lastblocknum & 0x0ff)       };       byte[] result = mifare.transceive(command);     } catch (ioexception e) {       log.e("error communicating card: ", e.tostring());     }   } } 


Comments

Popular posts from this blog

Sort a complex associative array in PHP -

vb.net - How to ignore if a cell is empty nothing -

recursion - Can every recursive algorithm be improved with dynamic programming? -