1

Creating react native NFC read/write application using https://github.com/whitedogg13/react-native-nfc-manager ->with this plugin. But I was not able to write lock after writing a NDEF record to tag.

try{
await NfcManager.writeNdefMessage(bytes)
        .then(()=>NfcManager.makeReadOnlyAndroid())//Write_lock android
        .then((result)=>{
          console.log("Make read Only result:->",result);
        });
}
catch (ex) {
      console.warn('exception', ex);
      _cleanUp();
     
    }

NDEF record was written successfully, but write lock was failed. Given below is tag Info which used.

{
   "canMakeReadOnly":false,
   "id":"043743CE80",
   "isWritable":true,
   "maxSize":254,
   "ndefMessage":[],
   "techTypes":[
      "android.nfc.tech.IsoDep",
      "android.nfc.tech.NfcA",
      "android.nfc.tech.Ndef"
   ],
   "type":"NFC Forum Type 4"
}

The same tag is write lockable with NXP "TagWritter" android mobile application.

Is their any way to use transceive() method to lock/change particular "lock-bit" or to fire-up some custom commands for NFC write locking.

AnAndHu S
  • 11
  • 2

1 Answers1

0

Are you sure that is the right way to makeReadOnly with this library see https://github.com/whitedogg13/react-native-nfc-manager/issues/66 for examples

Yes you should be able transceive a ISOUpdateBinary command direct to the Capability Container (CC) file to write to this standard file.

Detail are in the datasheet for the chip https://www.nxp.com/docs/en/data-sheet/NT4H2421Gx.pdf with more details in the NFC Type 4 Spec http://apps4android.org/nfc-specifications/NFCForum-TS-Type-4-Tag_2.0.pdf

But that is a lot of work when you could just call the native method of https://developer.android.com/reference/android/nfc/tech/Ndef#makeReadOnly()

(which is what the library is doing)

Andrew
  • 8,198
  • 2
  • 15
  • 35
  • Thanks for responding. I tried the samples.. since the tag is not NDEF formattable " read-only with NDEFwrite " is not possible. – AnAndHu S Sep 22 '20 at 17:28
  • Your comment "since the tag is not NDEF formattable" is illogical , if it is not NDEF formattable then in your question "But I was not able to write lock after writing a NDEF record to tag" and attempt call to `writeNdefMessage` is counter to this statement and counter to the datasheet. The only reason why you would not be able to format this card or write the read only config change is because it is already read only. – Andrew Sep 22 '20 at 19:11