Writing to NFC Tags

The NfcManager should handle the write methods, rather than relying on a
NfcTag object. The NfcTag object should only contain information about a
NfcTag that was read. Some platforms (Windows Phone 8, BlackBerry 10
WebWorks) only provide NDEF information and don't provide tag details.

write should take an array of NdefRecords

A tag must be in range when a when write is called, so this should be
called inside the nfc.onmessage function.

nfc.onmessage = function(nfcEvent) {

var ndefMessage = [
new NDEFRecordText("hello world", "en-US", "UTF-8");
]
 // success is called when the message is written
// error is called if something fails
promise = nfc.write(ndefMessage);
}

NfcManager needs additional methods like nfc.makeTagReadOnly();

Received on Tuesday, 28 October 2014 03:32:09 UTC