Taro.onHCEMessage(callback)
Listens on the event of receiving NFC device messages.
Type
(callback: Callback) => void
Parameters
Callback
The callback function for the event of receiving NFC device messages.
(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=2 is 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 | ✔️ |