NFCService Data Types
NFCService defines and uses several data types.
An object returned by an NFC read()
operation.
Property Name | Type | Description | Example |
---|---|---|---|
totalByteLength | Number | The size, in number of bytes, of the data received by the read() operation. | 256 |
records | NFCMessageRecord[] | An array containing a single NFCMessageRecord object, which in turn contains the payload from the NFC tag. | [NFCMessageRecord] |
An object within an NFCMessage
object, containing the payload read from an NFC tag.
Property Name | Type | Description | Example |
---|---|---|---|
parsed | NFCRecord | Contains the parsed values of the raw data read from the NFC tag. The parsing operation only occurs if the value of the typeNameFormat property on the NFCRecord object is "WELLKNOWN". Otherwise, this property’s value is null. | |
raw | NFCRecord | Contains the raw base64 data string read from the NFC tag. |
An object containing one record of data from an NFC tag scan.
Property Name | Type | Description | Example |
---|---|---|---|
typeNameFormat | TypeNameFormat | The Type Name Format field of the payload, as defined by the NDEF specification. | "WELLKNOWN" See TypeNameFormat for a list of possible values. |
type | String | The type of the payload, as defined by the NDEF specification. | "T" (when payload is of type text); "U" (when payload is of type URI) |
identifier | String | The identifier of the payload, as defined by the NDEF specification, or an empty string if no identifier data was present in the tag. | |
payload | String | The content of the record, encoded in base64 format. | "V2XigJlyZSBTYWxlc2ZvcmNlLCBG9tZXIgY29tcGFueS4" |
An object containing raw text input, to be converted into an NFCRecord
.
Property Name | Type | Description | Example |
---|---|---|---|
text | String | The raw text payload to be converted. | "We’re Salesforce, the customer company." |
langId | String | The ISO 639-1 language ID of the text. | "en" |
An object containing configuration details for an NFC interaction.
Property Name | Type | Description | Example |
---|---|---|---|
instructionText | String | Optional. Provides instructions to display in the user interface. Defaults to no text. | "Hold your phone near the tag to read." |
successText | String | Optional. Provides a message to display in the user interface when an NFC operation is successfully completed. Defaults to no text. | "Tag read successfully!" |
An object representing an error that occurred when accessing NFCService features.
Property Name | Type | Description |
---|---|---|
code | NFCServiceFailureCode | A value representing the reason for an error. See NFCServiceFailureCode for the list of possible values. |
message | String | A string value describing the reason for the failure. This value is suitable for use in user interface messages. The message is provided in English and isn’t localized. |
See Also