chariotsolutions / phonegap-nfc

PhoneGap NFC Plugin
MIT License
706 stars 556 forks source link

Windows: addMimeTypeListener #262

Closed andreujuanc closed 7 years ago

andreujuanc commented 7 years ago

Hello,

I'm making my app compatible with windows 10 mobile.

It currently uses addMimeTypeListener. I tried simple on a demo app on windows 10 mobile, and it does not work.

It just does not have the action here: CommandProxyMap[service][action]. It returns undefined.

Is the documentation wrong? from https://github.com/chariotsolutions/phonegap-nfc#nfcaddmimetypelistener

Supported Platforms

    Android
    Windows
    BlackBerry 7

Cheers

don commented 7 years ago

I'm looking at the Windows code and it looks like you need to use registerNdef https://github.com/chariotsolutions/phonegap-nfc/blob/master/src/windows/nfc-plugin.js#L77

TBH, I'm not sure why it's not called registerNdefListener. It's been a long time since I've looked at this Windows Mobile 10. It's effectively dead for me unless we start getting Windows tablets and laptops with NFC readers built in.

don commented 7 years ago

I looked into this a bit more.

Windows 10 doesn't support nfc.addMimeTypeListener. I've updated the documentation to reflect this.

All Windows devices (with NFC) should support nfc.addNdefListener. The NDEF listener will read MIME type tags on Windows.

Windows devices with newer NXP PN547 chips will support nfc.addTagDiscoveredListener. Windows won't give you any tag meta data, like the tag type or tag id. You can use addTagDiscoveredListener to read non-formatted tags and write NDEF messages to them. See #204.

andreujuanc commented 7 years ago

@don Thanks mate!