I need to implement NFC (near field communication) in a PWA (progressive webapplication).
I use this code but not worked:
Writing a string to an NFC tag:
if ("NDEFWriter" in window) {
const writer = new NDEFWriter();
await writer.write("Hello world!");
}
Scanning messages from NFC tags:
if ("NDEFReader" in window) {
const reader = new NDEFReader();
await reader.scan();
reader.onreading = ({ message }) => {
console.log(`Message read from a NFC tag: ${message}`);
};
}
Is it possible to use NFC in any way in a PWA?
Aucun commentaire:
Enregistrer un commentaire