Tag tag = intent.getParcelableExtra(NfcAdapter.EXTRA_TAG); NfcA nfcA = NfcA.get(tag); nfcA.connect(); byte[] result = nfcA.transceive(new byte[] { (byte)0x30, /* CMD = READ */ (byte)0x10 /* PAGE = 16 */ });
// test if tag is still connected NfcA nfca = NfcA.get(tags[0]); if (nfca != null) { try { nfca.connect(); byte[] response = nfca.transceive(new byte[] { (byte)0x30, (byte)0x00 }); if ((response != null) && (response.length > 0)) return Boolean.TRUE; } } finally { ndef.close(); } }
NfcA nfcA = NfcA.get(tag); nfcA.connect(); byte[] result1 = nfcA.transceive(new byte[] { (byte)0xA2, /* CMD = WRITE */ (byte)0x02, /* PAGE = 2 */ (byte)0x00, (byte)0x00, (byte)0xFF, (byte)0xFF /* DATA = lock pages 3..15 */ }); byte[] result2 = nfcA.transceive(new byte[] { (byte)0xA2, /* CMD = WRITE */ (byte)0x28, /* PAGE = 40 */ (byte)0x0F, (byte)0x00, (byte)0x00, (byte)0x00 /* DATA = lock pages 16..27 */ });
mTag.connect(); }catch(IOException e){
NfcA nfcA = NfcA.get(tag); if (nfcA != null) { try { nfcA.connect(); nfcA.transceive(new byte[] { (byte)0xA2, // WRITE (byte)0x03, // page = 3 (byte)0xE1, (byte)0x10, (byte)0x06, (byte)0x00 // capability container (mapping version 1.0, 48 bytes for data available, read/write allowed) }); nfcA.transceive(new byte[] { (byte)0xA2, // WRITE (byte)0x04, // page = 4 (byte)0x03, (byte)0x00, (byte)0xFE, (byte)0x00 // empty NDEF TLV, Terminator TLV }); } catch (Exception e) { } finally { try { nfcA.close(); } catch (Exception e) { } } }
nfcA.connect(); int read = 0; for (int i = 0; i < reads; i++) {