-
Notifications
You must be signed in to change notification settings - Fork 69
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Notify NFCReaders of failures when trying to get a message from a tag? #279
Comments
So I assume the problem we have here is that 1) is an empty formatted tag that doesn't even have the empty record? |
Exactly. |
Could we return an empty record? |
For context, this came up in review. In chromium implementation, I do see a kNfcEmpytMessage used to throw an exception while pushing empty message to tag. We could use something similar while reading also ? |
For TagLostException, we can just avoid dispatching the event as no tag was fully read. |
We should probably do like Generic Sensor and have an onerror event handler as well, which somehow can handle the error cases |
So, for the null ndef message case we dispatch a reading event with a ndef message containing just an empty record; for Note: These events are dispatched to ALL active readers, without any message filtering for matching their reader options. |
Sounds good, but I think we might want to consider adding a "formatted" type, similarly to the "empty" type |
According to #367, reading non-formatted tags result in a onreading event with empty records array for NDEFMessage. |
Ooops! We should not close it. Dispatching event errors in |
So you suggest we readd the error event for that? Or other solutions? |
I didn't find any other solution sadly that satisfies me but re-adding the NDEFError event. |
I think so, too. |
For info, I have a PR at #432 that attempts to fix this. |
See
https://developer.android.com/reference/android/nfc/tech/Ndef.html#getNdefMessage().
Once a tag is discovered, we call
android.nfc.tech.Ndef.getNdefMessage()
to try to get a message from it, which mayINITIALIZED
state, i.e. formatted but emptyTagLostException,
IOException,
orFormatException
In such cases do we need to let all active
NFCReaders
be aware of these failures so that they can choose how to proceed next? i.e. dispatching some error events properly toNFCReaders.
Currently http://w3c.github.io/web-nfc/#the-nfc-reading-algorithm only describes the case that a ndef message has already been gotten from the tag, so does the implementation in Chromium.
The text was updated successfully, but these errors were encountered: