Provides types and events for receiving NFC tags.
- Source:
Type Definitions
NfcRecord
Properties:
Name | Type | Description |
---|---|---|
id |
string | The unique ID of the NFC record. |
payload |
string | The record text. |
recordType |
string | Corresponds to the Android record.Tnf. |
- Source:
TagReceivedEventArgs
Properties:
Name | Type | Description |
---|---|---|
id |
string | The unique ID of the NFC event. |
records |
Array.<airlock.nfc.NfcRecord> | The list of records. |
handled |
boolean | This must be set to true to prevent default actions from being performed (if any). |
- Source:
Events
onTagReceived
onTagReceived Event. Is raised on supported devices
when a NFC tag is received by the device.
To subscribe to the event use:
airlock.nfc.onTagReceived.addListener(function (args) {})
To unsubscribe to the event use:
airlock.nfc.onTagReceived.removeListener(afunctionReference)
Type:
- Source:
Example
// Subscribe to event
airlock.nfc.onTagReceived.addListener(handleTagReceived);
function handleTagReceived(args) {
for (let record of args.records) {
alert(record.payload);
}
args.handled = true;
}
// Unsubscribe
airlock.nfc.onTagReceived.removeListener(handleTagReceived);