I have an Android app that reads NFC tags. Everything works fine on the LG Nexus 4 but on Samsung Galaxy S5 I only get I/O exceptions (tested on multiple phones).
So, tags are of type NfcV and I get the I/O exception when calling connect()
on the NfcV (further down it is error code -5 ERROR_CONNECT).
NFC TagInfo by NXP can read the the memory content of the tag on the SG5S - are there other ways of reading NfcV tags than with connect()
and transceive()
?
What differences between NFC chips will cause my app's connection to fail on one phone but not the other (while other apps read it fine)? Are there timeouts I need to adjust maybe?
Code snippet:
NfcV nfcvTag = NfcV.get(intent.getParcelableExtra(NfcAdapter.EXTRA_TAG));
if(nfcvTag!=null){
try {
nfcvTag.connect();
//{flags:0x00, read multiple blocks command: 0x23, start at block 0: 0x00, read 9 blocks (0 to 8): 0x08}
response = nfcvTag.transceive(new byte[] {(byte)0x00,(byte)0x23,(byte)0x00,byte)0x08});
} catch (IOException e) {
Log.d("NFCService", nfcvTag.toString());
} finally {
try {
nfcvTag.close();
} catch (IOException e) {
}
}
}
NfcV.get()
and thenfcv.connect()
after you receive the intent? Or is there any processing/creation of new threads etc. in between? Also just to confirm: It's theconnect()
method that throws the exception and not thetransceive()
method, right? – Alcheringaconnect()
fails when done in an IntentService puzzles me. – Ohg