title: Taro.onHCEMessage(callback)

sidebar_label: onHCEMessage

Listens on the event of receiving NFC device messages.

Reference

Type

  1. (callback: Callback) => void

Parameters

Callback

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

  1. (result: CallbackResult) => void
Property Type
result CallbackResult

CallbackResult

Property Type Description
data ArrayBuffer WhenmessageType=1, the app receives a command from the NFC device.
messageType 1 | 2 Message type
reason number The reason whenmessageType=2is returned

messageType

Valid values of messageType

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

API Support

API WeChat Mini-Program H5 React Native
Taro.onHCEMessage ✔️