NFC.startCapture()
Overview
Starts NFC capture of NDEF tags. Acquired NDEF tags are delivered through "Ndef" events.
Added in version 2.1.25
Format
NFC.startCapture();
Example
Copy
/* This is an example of the NFC.startCapture script API.
* Ndef tags are processed as barcodes.
* NFC capture is disabled after exiting the scope.
*/
NFC.startCapture();
WLEvent.on("Ndef",function(event){
if(event.ndefRecords[0].type === "uri"){
Device.fakeScan("nfc", event.ndefRecords[0].uri);
}else if(event.ndefRecords[0].type === "text"){
Device.fakeScan("nfc", event.ndefRecords[0].text);
}
});
WLEvent.onExitScope(function () {
NFC.stopCapture();
});