English
Platform difference description for iBeacon APIs
App | H5 | 微信小程序 | 支付宝小程序 | 百度小程序 | 抖音小程序 | 飞书小程序 | QQ小程序 | 快手小程序 | 京东小程序 |
---|---|---|---|---|---|---|---|---|---|
√ | x | √ | √ | x | x | √ | x | x | x |
listen to iBeacon service status change events
CALLBACK return parameter
Attribute | Type | Instruction |
---|---|---|
available | boolean | Is the service is currently available? |
discovering | boolean | Whether it is in the searching state currently |
listen to iBeacon device update events
CALLBACK return parameter
Attribute | Type | Instruction |
---|---|---|
beacons | Array<IBeaconInfo> | List of all iBeacon devices that are searched currently |
Obtain all searched iBeacon devices.
OBJECT parameter description
Attribute | Type | Defaults | Required | Instruction |
---|---|---|---|---|
success | function | No | Callback function for successful interface calling | |
fail | function | No | Callback function for failed interface calling | |
complete | function | No | Callback function for closed interface calling (available both for successful and failed calling) |
Success return parameter description:
Attribute | Type | Instruction |
---|---|---|
beacons | Array<IBeaconInfo> | iBeacon device list |
Error code | Error message | Instruction |
---|---|---|
0 | ok | Normal |
11000 | unsupport | Not supported by the system or device |
11001 | bluetooth service unavailable | Bluetooth service is unavailable |
11002 | location service unavailable | Location service is unavailable |
11003 | already start | Search started |
Start searching for nearby iBeacon devices
OBJECT parameter description
Attribute | Type | Defaults | Required | Instruction |
---|---|---|---|---|
uuids | Array<String> | Yes | uuid list broadcast by iBeacon device | |
ignoreBluetoothAvailable | boolean | false | No | Whether to check the Bluetooth on/off, valid only on iOS |
success | function | No | Callback function for successful interface calling | |
fail | function | No | Callback function for failed interface calling | |
complete | function | No | Callback function for closed interface calling (available both for successful and failed calling) |
Error code | Error message | Instruction |
---|---|---|
0 | ok | Normal |
11000 | unsupport | Not supported by the system or device |
11001 | bluetooth service unavailable | Bluetooth service is unavailable |
11002 | location service unavailable | Location service is unavailable |
11003 | already start | Search started |
uni.startBeaconDiscovery({
success(res) { }
})
Stop searching for nearby iBeacon devices
OBJECT parameter description
Attribute | Type | Defaults | Required | Instruction |
---|---|---|---|---|
success | function | No | Callback function for successful interface calling | |
fail | function | No | Callback function for failed interface calling | |
complete | function | No | Callback function for closed interface calling (available both for successful and failed calling) |
Error code | Error message | Instruction |
---|---|---|
0 | ok | Normal |
11000 | unsupport | Not supported by the system or device |
11001 | bluetooth service unavailable | Bluetooth service is unavailable |
11002 | location service unavailable | Location service is unavailable |
11003 | already start | Search started |
Attribute | Type | Instruction |
---|---|---|
uuid | string | uuid broadcast by iBeacon device |
major | string | Primary id of iBeacon device |
minor | string | Secondary id of iBeacon device |
proximity | number | Enumeration value representing device distance |
accuracy | number | Distance of iBeacon device |
rssi | number | Indicate the signal strength of the device |