NFC.stopCapture()

Overview

Stops NFC capture of NDEF tags. After capture is stopped, NDEF tags are handled by the OS and no longer delivered through "Ndef" events.

Added in version 2.1.25

Format

NFC.stopCapture();

Example

Copy
/* This is an example of the NFC.stopCapture 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();
});