Replies: 2 comments 8 replies
-
You can do that in "one step", e.g.: import { Nfc, NfcUtils, NfcTagTechType } from '@capawesome-team/capacitor-nfc';
const createNdefTextRecord = () => {
const utils = new NfcUtils();
const { record } = utils.createNdefTextRecord({ text: 'Capacitor NFC Plugin' });
return record;
};
const formatAndWrite = async () => {
const record = createNdefTextRecord();
return new Promise((resolve) => {
Nfc.addListener('nfcTagScanned', async (event) => {
await Nfc.format();
await Nfc.write({ message: { records: [record] } });
await Nfc.stopScanSession();
resolve();
});
Nfc.startScanSession();
});
}; |
Beta Was this translation helpful? Give feedback.
-
That's what I tried but without success. The following happens in Console: ticket-swap:249 native Nfc.startScanSession (#81836919) |
Beta Was this translation helpful? Give feedback.
-
Hi, is it possible to Format to NDEF and Write NDEF Record in one Step or do i need to rescan the tag for the second operation?
Beta Was this translation helpful? Give feedback.
All reactions