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

> @OlivierGrenoble How would like it work?

I need some time to think about it. Here are some elements:

In my application, I didn't want to have a scan() listening for NFC events all the time because this would take the hand over the native processing of an NFC event. So I'm calling scan() only when the user has clicked on a button to read the tag content.

We can maybe find inspiration from what is done in Android with enableforegrounddispatch() function:
https://developer.android.com/reference/android/nfc/NfcAdapter#enableForegroundDispatch(android.app.Activity,%20android.app.PendingIntent,%20android.content.IntentFilter%5B%5D,%20java.lang.String%5B%5D%5B%5D)

The WebPage would subscribe to get the NFC notifications but only when it is in the foreground. If the user changes Tab in Chrome or goes to another application, the WebPage would stop catching the NFC events otherwise it would prevent other applications from getting them.




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

Received on Thursday, 19 March 2020 07:15:39 UTC