May 19, 2021 WeChat Mini Program Development Document
Base library 1.7.0 starts to support, and low versions need to be compatible.
Send an NFC message. Valid only under Android.
Property | Type | The default | Required | Description |
---|---|---|---|---|
data | ArrayBuffer | Is | Binary data | |
success | function | Whether | The interface calls a successful callback function | |
fail | function | Whether | The interface calls the failed callback function | |
complete | function | Whether | Callback function at end of interface call (call succeeds, fails are executed) |
Error code | The error message | Description |
---|---|---|
0 | Ok | Normal |
13000 | NFC is not supported by the current device | |
13001 | The current device supports NFC, but the system NFC switch is not on | |
13002 | The current device supports NFC, but not HCE | |
13003 | The AID list parameters are in the wrong format | |
13004 | WeChat is not set as the default NFC payment app | |
13005 | The instructions returned are not legal | |
13006 | Registration of the AID failed |
const buffer = new ArrayBuffer(1)
const dataView = new DataView(buffer)
dataView.setUint8(0, 0)
wx.startHCE({
success (res) {
wx.onHCEMessage(function(res) {
if (res.messageType === 1) {
wx.sendHCEMessage({data: buffer})
}
})
}
})