The method of utilizing this API is wx.stopBeaconDiscovery(Object object).
Attributes | Types | Default value | Required | Note |
success | function | - | Not required | Callback function for successful interface invocation |
fail | function | - | Not required | Callback function for unsuccessful interface invocation |
complete | function | - | Not required | Callback function executed upon the completion of the interface invocation (both successful and unsuccessful invocations) |
Error Codes | Error Message | Note |
0 | ok | Normal |
11000 | unsupport | System or device not supported |
11001 | bluetooth service unavailable | Bluetooth service is unavailable |
11002 | location service unavailable | Location services are unavailable |
11003 | already start | Search has commenced |
11004 | not startBeaconDiscovery | Search has not yet commenced |
11005 | system error | System error |
11006 | invalid data | Parameters are incorrect |
The method for using this API is wx.startBeaconDiscovery(Object object)
Attributes | Types | Default value | Required | Note |
uuids | Array.<string> | - | Supported | List of UUIDs broadcasted by Beacon devices |
ignoreBluetoothAvailable | boolean | false | Not required | Verifies the Bluetooth switch, effective only on iOS. From iOS 11 onwards, even if Bluetooth is turned off in the control panel, the Beacon service can still be used. |
success | function | - | Not required | Callback function for successful interface invocation |
fail | function | - | Not required | Callback function for unsuccessful interface invocation |
complete | function | - | Not required | Callback function executed upon the completion of the interface invocation (both successful and unsuccessful invocations) |
Error Codes | Error Message | Note |
0 | ok | Normal |
11000 | unsupport | System or device not supported |
11001 | bluetooth service unavailable | Bluetooth service is unavailable |
11002 | location service unavailable | Location services are unavailable |
11003 | already start | Search has commenced |
11004 | not startBeaconDiscovery | Search has not yet commenced |
11005 | system error | System error |
11006 | invalid data | Parameters are incorrect |
wx.startBeaconDiscovery({success(res) { }})
The method for using this API is wx.onBeaconUpdate(function listener)
Attributes | Types | Note |
beacons | The list of all Beacon devices currently detected. |
wx.onBeaconUpdate(res => {console.log(res.beacons)})
The method for using this API is wx.offBeaconUpdate()
wx.offBeaconUpdate()
The method for using this API is wx.onBeaconServiceChange(function listener)
Attributes | Types | Note |
available | boolean | Is the service currently available? |
discovering | boolean | Is it currently in search mode? |
wx.onBeaconServiceChange(res => {console.log(res.available, res.discovering)})
The method for using this API is wx.offBeaconServiceChange()
wx.offBeaconServiceChange()
The method for using this API is wx.getBeacons(Object object)
Attributes | Types | Default value | Required | Note |
success | function | - | Not required | Callback function for successful interface invocation |
fail | function | - | Not required | Callback function for unsuccessful interface invocation |
complete | function | - | Not required | Callback function executed upon the completion of the interface invocation (both successful and unsuccessful invocations) |
Attributes | Types | Note |
beacons | Beacon Device List |
Error Codes | Error Message | Note |
0 | ok | Normal |
11000 | unsupport | System or device not supported |
11001 | bluetooth service unavailable | Bluetooth service is unavailable |
11002 | location service unavailable | Location services are unavailable |
11003 | already start | Search has commenced |
11004 | not startBeaconDiscovery | Search has not yet commenced |
11005 | system error | System error |
11006 | invalid data | Parameters are incorrect |
Attribute | Types | Note |
uuid | string | UUID broadcasted by the beacon device. |
major | number | Primary ID of the beacon device. |
minor | number | Secondary ID of the beacon device. |
proximity | number | Enumeration value representing the device's distance (iOS only) |
accuracy | number | Distance to the beacon device, measured in meters. On iOS, when proximity is 0, accuracy is -1. |
rssi | number | Indicates the strength of the device's signal, measured in dBm. |
Value | Note |
0 | The signal is too weak to calculate the distance, or the device is not an iOS device. |
1 | Extremely close |
2 | Relatively close |
3 | Distant |
Was this page helpful?