This API is used via wx.stopBeaconDiscovery(Object object).
Attribute name | Type | Default value | Required | Description |
success | function | - | No | Callback Function of Successful Interface Call |
fail | function | - | No | Callback Function of Failing Interface Call |
complete | function | - | No | Callback function executed upon the completion of the interface invocation (both successful and unsuccessful invocations) |
Error code | Error Message | Description |
0 | ok | Normal |
11000 | unsupport | Not supported by the system or device. |
11001 | bluetooth service unavailable | Bluetooth services are unavailable. |
11002 | location service unavailable | Location services are unavailable. |
11003 | already start | Search has started. |
11004 | not startBeaconDiscovery | Search has not started. |
11005 | system error | System error |
11006 | invalid data | Parameters are incorrect. |
This API is used via wx.startBeaconDiscovery(Object object).
Attribute name | Type | Default value | Required | Description |
uuids | Array.<string> | - | Yes | List of UUIDs broadcast by a beacon device. |
ignoreBluetoothAvailable | boolean | false | No | Whether to verify the Bluetooth switch, which is 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 | - | No | Callback Function of Successful Interface Call |
fail | function | - | No | Callback Function of Failing Interface Call |
complete | function | - | No | Callback function executed upon the completion of the interface invocation (both successful and unsuccessful invocations) |
Error code | Error Message | Description |
0 | ok | Normal |
11000 | unsupport | Not supported by the system or device. |
11001 | bluetooth service unavailable | Bluetooth services are unavailable. |
11002 | location service unavailable | Location services are unavailable. |
11003 | already start | Search has started. |
11004 | not startBeaconDiscovery | Search has not started. |
11005 | system error | System error |
11006 | invalid data | Parameters are incorrect. |
wx.startBeaconDiscovery({success(res) { }})
This method is used via wx.onBeaconUpdate(function listener).
Attribute name | Type | Description |
beacons | List of all Beacon devices that have currently been detected. |
wx.onBeaconUpdate(res => {console.log(res.beacons)})
This API is used via wx.offBeaconUpdate().
This API is used via wx.onBeaconServiceChange(function listener).
Attribute name | Type | Description |
available | boolean | Is the service currently available? |
discovering | boolean | Is it currently in search mode? |
wx.onBeaconServiceChange(res => {console.log(res.available, res.discovering)})
This API is used via wx.offBeaconServiceChange().
This API is used via wx.getBeacons(Object object).
Attribute name | Type | Default value | Required | Description |
success | function | - | No | Callback Function of Successful Interface Call |
fail | function | - | No | Callback Function of Failing Interface Call |
complete | function | - | No | Callback function executed upon the completion of the interface invocation (both successful and unsuccessful invocations) |
Attribute name | Type | Description |
beacons | List of Beacon devices |
Error code | Error Message | Description |
0 | ok | Normal |
11000 | unsupport | Not supported by the system or device. |
11001 | bluetooth service unavailable | Bluetooth services are unavailable. |
11002 | location service unavailable | Location services are unavailable. |
11003 | already start | Search has started. |
11004 | not startBeaconDiscovery | Search has not started. |
11005 | system error | System error |
11006 | invalid data | Parameters are incorrect. |
Attribute name | Type | Description |
uuid | string | UUID broadcast by a beacon device. |
major | number | Primary ID of beacon device |
minor | number | Secondary ID of 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 signal strength of the device, measured in dBm. |
Value | Description |
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?