Sending Messages to Peers

I like the idea of sending a message in nfc.onpeerready() but I think this
is going to be very difficult to implement. I'd rather see
nfc.share(message) in the NfcManager.

Android will let you share a message at any time, even if a peer is not in
range. The message is automatically sent whenever a peer enters the field.

promise = nfc.share(ndefMessage);

Android continues to send the message until it is unpublished. We could
make the API send this one time since it works better with a promise
callback.

Windows Phone shares messages with peers by passing different parameters to
proximityDevice.PublishBinaryMessage.  On WP8, write and share are almost
identical. Windows Phone expects nfc.share(ndefMessage) to be called when a
peer is within range. e.g.from within nfc.onmessage().  Windows phone only
shares the message one time.

We need to define our share behavior so that it can be implemented on many
platforms.

An unshare function can be added the the NfcManager to cancel a shared
message, or potentially use nfc.share(null).

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