chariotsolutions / phonegap-nfc

PhoneGap NFC Plugin
MIT License
712 stars 570 forks source link

Windows Phone 8 even only fires on tags that already have NDEF record set #111

Closed JohnMcLear closed 10 years ago

JohnMcLear commented 10 years ago

If you have a tag with a blank NDEF record or it hasn't been set Windows Phone can't fire the nfc.addTagDiscoveredListener event.

This is well documented but it is also a relatively severe limitation as new tags that haven't been written to or have no ndef record will fail to write.

I'm sure this is WP8 API limitation but it's worth documenting where this limitation comes from and if there is a parent bug on the cordova bugtracker or WP8 bugtracker that we can follow to introduce this functionality in the future.

See: https://github.com/mclear/NFC_Ring_Control/issues/19#issuecomment-32041358 for posterity.

don commented 10 years ago

This is a windows problem. It only reads NDEF tags.

Work arounds would be to format the tags with an Empty NDEF record or a URI record like http://nfcring.com.

I'll update the documentation.

VaticanUK commented 10 years ago

John sent me here after I sent him an e-mail.

The latest update said that text records aren't supported on Windows Phone due to an API limitation, however this would seem to be inaccurate since plenty of other NFC apps do support writing text records such as the 'NFC Interactor' app... NFC tags do need to already be NDEF formatted however as mentioned above.

Is it a limitation of Apache Cordova?

don commented 10 years ago

TextRecords should be supported on Win Phone 8. This issue (#111) is that Win Phone 8 can't format a NFC tag. The The tag has to be NDEF before Win Phone 8 can read/write.

VaticanUK commented 10 years ago

OK, that fits with my understanding.

I sent an e-mail to John to query this line in the latest update:

"We now support Text records (Such as your public bitcoin key). However, due to Windows Phone API limitations this functionality is currently limited to Android."

and he asked me to discuss is in this issue.

The NDEF limitation will affect all use on Windows Phone since it only supports reading and writing NDEF formatted tags, so I don't see where the Text record limitation comes in for Windows Phone?

don commented 10 years ago

TextRecords work on WP8.

ndeftextrecord_windowsphone

don commented 10 years ago

There's nothing I can do about non NDEF tags, that's a Windows Phone limitation. If WP8 support changes in the future, we can revisit.

JohnMcLear commented 10 years ago

Hrm, why is it I didn't adopt it then? There was a reason but I can't remember why... Surely if you write text on WP8 using phonegap-nfc it writes it as an NDEF (rhetorical) so you can easily fire an event after that.. There must have been a reason I didn't enable this..

https://github.com/mclear/NFC_Ring_Control/blob/master/www/js/index.js#L100 is how I usually write text records, man that file is a mess.. Will clean it up..