Skip to main content
Version: Next

Taro.onHCEMessage(callback)

Listens on the event of receiving NFC device messages.

Reference

Type

(callback: Callback) => void

Parameters

Callback

The callback function for the event of receiving NFC device messages.

(result: CallbackResult) => void
PropertyType
resultCallbackResult

CallbackResult

PropertyTypeDescription
dataArrayBufferWhenmessageType=1, the app receives a command from the NFC device.
messageType1 | 2Message type
reasonnumberThe reason whenmessageType=2is returned

messageType

Valid values of messageType

PropertyDescription
1HCE APDU Command type. The Mini Program needs to process this command and call the sendHCEMessage API to return the processed command.
2Device departure event type

API Support

APIWeChat Mini-ProgramH5React Native
Taro.onHCEMessage✔️