EddyVerbruggen / nativescript-nfc

:pencil: NativeScript plugin to discover, read, and write NFC tags
MIT License
84 stars 37 forks source link

Can not write to tag; didn't receive an intent #43

Closed przpl closed 5 years ago

przpl commented 5 years ago

When I try to write tag on Android I get the following error: Can not write to tag; didn't receive an intent.

nfc.writeTag({
            textRecords: [
                {
                    id: [1],
                    text: "Hello"
                },
                {
                    id: [3, 7],
                    text: "Goodbye"
                }
            ]
        });

I have enabled NFC on my smartphone. I have tested it on Android 6 and Android 9 and on both I have the same error. Both available and enabled methods return true.

EddyVerbruggen commented 5 years ago

I realize this is not documented, but IIRC you have to scan a tag before you’re able to write to it. So add a tag discovered listener and when it’s triggered, try to write to it.