Coding With Fun
Home Docker Django Node.js Articles Python pip guide FAQ Policy

WeChat Apple API - Device - iBeacon


May 19, 2021 WeChat Mini Program Development Document


Table of contents


wx.startBeaconDiscovery(OBJECT)

Base library 1.2.0 starts to support, and low versions need to be compatible

Start searching for iBeacon devices

OBJECT parameter description:

The name of the argument Type Required Description
uuids StringArray Is uuids broadcast by iBeacon devices
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)

Success returns a description of the parameters:

The name of the argument Type Description
errMsg String The result of the call

Example code:

wx.startBeaconDiscovery({
    success(res) {
    }
})

wx.stopBeaconDiscovery(OBJECT)

Base library 1.2.0 starts to support, and low versions need to be compatible

Stop searching for iBeacon devices

OBJECT parameter description:

The name of the argument Type Required Description
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)

Success returns a description of the parameters:

The name of the argument Type Description
errMsg String The result of the call

wx.getBeacons(OBJECT)

Base library 1.2.0 starts to support, and low versions need to be compatible

Get all the iBeacon for

OBJECT parameter description:

The name of the argument Type Required Description
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)

Success returns a description of the parameters:

The name of the argument Type Description
beacons ObjectArray List of iBeacon devices
errMsg String The result of the call

iBeacon structure:

Parameters Type Description
Uuid String The uuid broadcast by the iBeacon device
major String The primary id of the iBeacon device
minor String The secondary id of the iBeacon device
proximity Number The enumeration value that represents the distance of the device
accuracy Number The distance of the iBeacon device
Rssi Number Indicates the signal strength of the device

wx.onBeaconUpdate(CALLBACK)

Base library 1.2.0 starts to support, and low versions need to be compatible

Listen for iBeacon devices

CALLBACK returns a description of the parameters:

The name of the argument Type Description
beacons array object A list of all iBeacon devices currently searched for

iBeacon structure:

Parameters Type Description
Uuid String The uuid broadcast by the iBeacon device
major String The primary id of the iBeacon device
minor String The secondary id of the iBeacon device
proximity Number The enumeration value that represents the distance of the device
accuracy Number The distance of the iBeacon device
Rssi Number Indicates the signal strength of the device

wx.onBeaconServiceChange(CALLBACK)

Base library 1.2.0 starts to support, and low versions need to be compatible

Listen for iBeacon service

CALLBACK returns a description of the parameters:

The name of the argument Type Description
available Boolean Whether the service is currently available
discovering Boolean Whether you are currently searching

The list of error codes

Error code Description Note
0 Ok Normal
11000 unsupport The system or device is not supported
11001 bluetooth service unavailable Bluetooth service is not available
11002 location service unavailable Location services are not available
11003 already start A search has begun