tencent cloud

Feedback

Bluetooth - Beacon

Last updated: 2024-03-04 23:10:04

    stopBeaconDiscovery

    This API is used via wx.stopBeaconDiscovery(Object object).
    Feature Description: Ceases the search for nearby Beacon devices.
    Parameter and Description: 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 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.

    startBeaconDiscovery

    This API is used via wx.startBeaconDiscovery(Object object).
    Feature Description: Starts the search for nearby Beacon devices.
    Parameter and Description: 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 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.
    Sample Code
    wx.startBeaconDiscovery({
    success(res) { }
    })

    onBeaconUpdate

    This method is used via wx.onBeaconUpdate(function listener).
    Feature Description: Monitors Beacon device update events, with only one listener registration permissible.
    Parameter and Description: Object res parameter, function listener, the listener function for Beacon device update events.
    Attribute name
    Type
    Description
    beacons
    Array.<BeaconInfo>
    List of all Beacon devices that have currently been detected.
    Sample Code
    wx.onBeaconUpdate(res => {
    console.log(res.beacons)
    })

    offBeaconUpdate

    This API is used via wx.offBeaconUpdate().
    Feature Description: Removes all listener functions for Beacon device update events.

    onBeaconServiceChange

    This API is used via wx.onBeaconServiceChange(function listener).
    Feature Description: Monitors events of Beacon service status changes, with only one listener registration permissible.
    Parameter and Description: Object res parameter, function listener, the listener function for events of Beacon service status changes.
    Attribute name
    Type
    Description
    available
    boolean
    Is the service currently available?
    discovering
    boolean
    Is it currently in search mode?
    Sample Code
    wx.onBeaconServiceChange(res => {
    console.log(res.available, res.discovering)
    })

    offBeaconServiceChange

    This API is used via wx.offBeaconServiceChange().
    Feature Description: Removes all listener functions for events of Beacon service status changes.

    getBeacons

    This API is used via wx.getBeacons(Object object).
    Feature Description: Gets all detected Beacon devices.
    Parameter and Description: 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)
    Parameters for object.success callback function: Object res.
    Attribute name
    Type
    Description
    beacons
    Array.<BeaconInfo>
    List of Beacon devices
    Error Code
    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.

    BeaconInfo

    Feature Description: Beacon Device.
    Attribute and Descriptions
    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.
    Valid values for proximity
    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
    
    Contact Us

    Contact our sales team or business advisors to help your business.

    Technical Support

    Open a ticket if you're looking for further assistance. Our Ticket is 7x24 avaliable.

    7x24 Phone Support