Is it possible to read and write at the same time and check the UID before writing?
I've tried this, but the id is empty:
NfcManager.requestTechnology(NfcTech.Ndef)
.then(() => {
// return NfcManager.getTag() // <-- If this is use, it double the NFC prompt with possible `cancelTechnologyRequest` call missing
return NfcManager.ndefHandler.getNdefMessage()
})
.then((tag) => {
console.log(tag?.id) // Result is null
// <---- I want to check the UID here
const bytes = Ndef.encodeMessage([Ndef.textRecord("Hello")])
return NfcManager.ndefHandler.writeNdefMessage(bytes)
})
.then(() => {
if (Platform.OS === "ios") {
NfcManager.setAlertMessageIOS("Written")
}
})
.finally(() => NfcManager.cancelTechnologyRequest())
Is it possible to read and write at the same time and check the UID before writing?
I've tried this, but the
id
is empty: