Write text to an NFC tag.
- payloads–(Required) An array of
NFCRecordobjects containing the raw bytes to be written.
- options—(Optional) An
NFCServiceOptionsobject to configure the NFCService request.
If successful, the value of the
successText property on the
NFCServiceOptions object is returned by the OS. If unsuccessful, an error message is returned.
Use this function to write text to an NFC tag.
- If an error occurs, the error is returned via a rejected promise. Handle errors in a
- When the user cancels the operation, the promise is rejected with a
NFCServiceFailure.codevalue of USER_DISMISSED.
The caller is responsible for ensuring that the payload of the
NFCRecord object is correctly formatted, per NFC specifications. To help with this, we’ve provided two helper functions,
createUriRecord(). By using these functions, you can convert your text or URI payload to an NFC record first, and then pass those records to the
write() method to be written to the tag.