Confirmed users
118
edits
Line 173: | Line 173: | ||
== Sending/Writing NDEF messages == | == Sending/Writing NDEF messages == | ||
In P2P mode, there are two event listeners that can be registered by the applications. | In P2P mode, there are two event listeners that can be registered by the applications. Applications should have 'nfc-write' permissions in order to register for 'onpeerready' and 'onpeerlost'. | ||
'''1. onpeerready''' : Fired when there is another nfc peer phone is close proximity (in its near-field) and if the registered Nfc application is top-most (visible) application. | '''1. onpeerready''' : Fired when there is another nfc peer phone is close proximity (in its near-field) and if the registered Nfc application is top-most (visible) application. | ||
Ex:- ''var nfcdom = window.navigator.mozNfc; | Ex:- ''var nfcdom = window.navigator.mozNfc; | ||
nfcdom.onpeerready = function(event) { | nfcdom.onpeerready = function(event) { | ||
// perform write ndef operation | |||
. | . | ||
}'' | }'' | ||
Line 184: | Line 184: | ||
''Ex:- var nfcdom = window.navigator.mozNfc; | ''Ex:- var nfcdom = window.navigator.mozNfc; | ||
nfcdom.onpeerlost = function(event) { | nfcdom.onpeerlost = function(event) { | ||
. | // If necessary, show an UI indication that device is lost. | ||
. | . | ||
}'' | }'' |