createTextRecord(payload)

Given a text payload, this function creates a properly formatted NFCRecord to be written to an NFC tag.

  • payload–(Required) The text to be converted to an NFC record.

A Promise object that resolves to an NFCRecord object.

A rejected promise returns an NFCServiceFailure.

Use this function to create and return an NFC record to use as a parameter for the write() function.

  • If an error occurs, the error is returned via a rejected promise. Handle errors in a catch clause.
  • When the user cancels the operation, the promise is rejected with a NFCServiceFailure.code value of USER_DISMISSED.

See Also