Re: [web-nfc] NDEF Read triggered when writting an NDEF (#551)

> A read after should only happen if you lost contact with the tag and regained it. Maybe that happens because we call "close()" on the connection and so maybe we should not before the tag is out of reach..

I think that it is indeed interesting to investigate when to close the connection.
There are 2 ways to use NFC tags:
- some users will keep their phone on the tag 
- some users will put the phone on the tag only when a read or write is necessary
In my opinion, it would be nice to support both. The first one is simpler but it is a bit annoying to be sticked to the tag. The second solution is much more confortable on that aspect.

When using the second solution, it will be annoying if the native processing is executed when non wanted. The application should be able to control that. I mean, it should be able to let the NFC service handle the NFC Event or it should be able to handle it itself.

In Android application this is controlled with enableforegrounddispatch().
When the application is in foreground, it can call this function to hook the NFC events. By this way, it will be notified when a tag is tapped and the native processing will not be executed. Calling this function is optional so the application has the ability to choose who should receive the NFC event.


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

Received on Wednesday, 25 March 2020 06:32:30 UTC