Re: [web-nfc] How to get started? (#145)

Having implemented this in production (a very specific usecase where enabling a feature flag is worth it for the convenience), here's a summary of my experience:

* It will only work in Chrome for Android (including tablets) when the feature flag is enabled
* `"nfc" in navigator` will return true if the feature flag is enabled _even if the device does not support NFC_. You'll need to handle a watch failure to deal with that.
* Reading
  * You'll need to pass in options to `watch` with `mode: "any"` otherwise it will only find tags written by web-nfc
  * It will flat out ignore external/opaque records (in our scenario the tags had URL + external, but Chrome only saw the URL)
* Writing
  * I can't remember the details, but writing a URL didn't result in a Well Known URI record (but we'd already ruled it out for writes due the lack of working support for external records)

FWIW, here's the TypeScript type definitions I used. I can only vouch for the read operations since that's all we ended up using. https://gist.github.com/richardszalay/dd39a3486b6477a126103c6ea354247b

-- 
GitHub Notification of comment by richardszalay
Please view or discuss this issue at https://github.com/w3c/web-nfc/issues/145#issuecomment-480787187 using your GitHub account

Received on Monday, 8 April 2019 11:07:12 UTC