Reputation: 11
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.
Upvotes: 1
Views: 513
Reputation: 10162
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)
Upvotes: 0