nfc - mifare classic 1k - Android - Tranceive failed on reading block -
i trying read blocks mifare classic card 1k , android nfc (on galaxy nexus).
private final int mmaxsize = 64; mclassic.connect(); boolean success = mclassic.authenticatesectorwithkeya(1, mifareclassic.key_default ); final bytearraybuffer b = new bytearraybuffer(mmaxsize); if (success) { b.append(mclassic.readblock(0), 0, 16); b.append(mclassic.readblock(1), 0, 16); b.append(mclassic.readblock(2), 0, 16); b.append(mclassic.readblock(3), 0, 16); }
if want read sector 0, that's ok. if want read different sector (for example sector 1), success has true value, when app go readblock()
, ioexception
triggered , have returned tranceiver failed.
what doing wrong?
in code example you're authenticating sector 1 try read blocks sector 0. remember sector , block numbers zero-based. may interested in blocktosector(int block).
Comments
Post a Comment