Closed moony-chen closed 11 months ago
Having the same issue. I wanted to add password block for safety.
await NfcManager.requestTechnology(NfcTech.Ndef, { alertMessage: gettext('Pronto per scrivere NFC!') });
const bytes = Ndef.encodeMessage([Ndef.textRecord(info.id)]);
if (bytes) {
await NfcManager.nfcAHandler.transceive([0x1b, ...password]);
await NfcManager.ndefHandler.writeNdefMessage(bytes);
if (Platform.OS === 'ios') {
await NfcManager.setAlertMessageIOS(gettext('Tag scritta correttamente!'));
}
}
By comparing a working native android example, I found a workaround by adding below code between the use of ndefHandler
and nfcAHandler
if (isAndroid) {
await (NfcManager as any).close();
await (NfcManager as any).connect([NfcTech.NfcA]);
}
However, this works only if reader mode is enabled.
For the default foreground dispatch mode, I have to patch the NfcManager.java
file:
private WritableMap parseNfcIntent(Intent intent) {
...
Tag tag = intent.getParcelableExtra(NfcAdapter.EXTRA_TAG);
...
synchronized(this) {
this.tag = tag; <--- add this line
if (writeNdefRequest != null) {
Hi @moony-chen #662 has been merged and included in latest release v3.14.8
, thanks for the contribution!
Hello there,
We have a NXP Ntag215, and we'd like to:
My code is something like this:
This I got
Error: unsupported tag api
If I switch the order inrequestTechnology
, then I gotError: java.lang.ClassCastException: android.nfc.tech.NfcA cannot be cast to android.nfc.tech.Ndef
Seems I cannot use them together, any advice to make this work?
Thank you!