Listening for NDEF Messages

Proposal - add message filters, rename startPolling and stopPolling

The web page needs to tell the NFC Manager that it wants to listen for NFC
messages.

The user should be able to apply a filter so the page only receives NFC
events that it is interested in and not ALL NFC messages that arrive.

Android does this with IntentFilters
<https://developer.android.com/guide/topics/connectivity/nfc/advanced-nfc.html#foreground-dispatch>
Firefox OS does this in the Manifest
<https://developer.mozilla.org/en-US/docs/Web/API/NFC_API/Using_the_NFC_API#Registering_the_NFC_web_activity>

Windows Phone does this with proximityDevice.subscribeForMessage
<http://msdn.microsoft.com/en-us/library/windows/apps/windows.networking.proximity.proximitydevice.subscribeformessage.aspx>

Currently nfc is started with nfc.startPolling. I think we need a different
name. The OS is listening for NFC events. The OS forwards these events to
our application if we register to be notified. The ndef message is pushed
to us in an event, we're not polling.

nfc.startPolling should be renamed nfc.subscribe(), nfc.register(),
nfc.listen(), or nfc.start(),
nfc.subscribe() should optionally accept filters to narrow scan by tag
type, tech or content.
nfc.subscribe() should return an error if the device does not have nfc or
nfc is disabled

nfc.stopPolling should be renamed to match the rename of nfc.unsubscribe()
nfc.unsubscribe() should not power down the NFC tag, that's the OS's job

Received on Tuesday, 28 October 2014 03:30:13 UTC