tencent cloud

Feedback

Bluetooth - Beacon

Last updated: 2024-11-21 18:48:11

    stopBeaconDiscovery

    The method of utilizing this API is wx.stopBeaconDiscovery(Object object).
    Function Description: Cease the search for nearby Beacon devices.
    Parameters and Description: 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 Code
    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

    startBeaconDiscovery

    The method for using this API is wx.startBeaconDiscovery(Object object)
    Function Description: Initiates the search for nearby Beacon devices.
    Parameters and Description: 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 Code
    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
    Example Code
    wx.startBeaconDiscovery({
    success(res) { }
    })

    onBeaconUpdate

    The method for using this API is wx.onBeaconUpdate(function listener)
    Function Description: Monitors the Beacon device update event, only one listener can be registered.
    Parameters and Description: function listener, the listener function for the Beacon device update event, with the following arguments Object res:
    Attributes
    Types
    Note
    beacons
    Array.<BeaconInfo>
    The list of all Beacon devices currently detected.
    Example Code
    wx.onBeaconUpdate(res => {
    console.log(res.beacons)
    })

    offBeaconUpdate

    The method for using this API is wx.offBeaconUpdate()
    Function Description: Removes all listener functions for the Beacon device update event.
    Sample Code
    wx.offBeaconUpdate()

    onBeaconServiceChange

    The method for using this API is wx.onBeaconServiceChange(function listener)
    Function Description: Monitors the Beacon service status change event, only one listener can be registered.
    Parameters and Description: function listener, listener for Beacon service state change events, with the following arguments Object res:
    Attributes
    Types
    Note
    available
    boolean
    Is the service currently available?
    discovering
    boolean
    Is it currently in search mode?
    Example Code
    wx.onBeaconServiceChange(res => {
    console.log(res.available, res.discovering)
    })

    offBeaconServiceChange

    The method for using this API is wx.offBeaconServiceChange()
    Function Description: Removes all listener functions for the Beacon service status change event.
    Sample Code
    wx.offBeaconServiceChange()

    getBeacons

    The method for using this API is wx.getBeacons(Object object)
    Function Description: Retrieves all detected Beacon devices.
    Parameters and Description: 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)
    object.success Callback Function Parameters: Object res.
    Attributes
    Types
    Note
    beacons
    Array.<BeaconInfo>
    Beacon Device List
    Error Code
    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

    BeaconInfo

    Function Description: Beacon Device.
    Properties and Descriptions
    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.
    Valid values for proximity
    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
    
    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