# Bluetooth Beacon (Beacon)

Base Library 1.2.0 Starts support.

Bluetooth Beacon is a broadcast protocol based on the Bluetooth Low Energy (BLE) protocol.

Beacon devices, as the peripheral equipment in Bluetooth Low Power Protocol, continuously broadcast specific packets containing device identification to the surrounding, but can not establish a connection with the central device.Weixin Mini Program The device running as the central device can receive the broadcast packet of the Beacon device and realize data interaction.It is often used in indoor location, message pushing and other scenarios.

Weixin Mini Program, developers can use wx.startBeaconDiscovery Start searching for Beacon devices and receive device update events via wx.onBeaconUpdate .

# 1. Device identification

Each beacon device's broadcast packet carries at least the following information, which together make up the device's unique identifier.

  • UUID (16 bytes): A 128-bit UUID that uniquely identifies a series of beacon devices identified by Weixin Mini Program.
  • Major (2 bytes): 0-65535 unsigned integer that can be used to distinguish a group of devices with the same UUID.
  • Minor (2 bytes): 0-65535 unsigned integer that can be used to distinguish between devices with the same UUID and major.

# 2. Device Status

When Weixin Mini Program receives a signal from a beacon device, it also provides the following information

  • Rssi: signal strength in dBm.
  • Proximity: Beacon An enumeration value that identifies the distance between devices (iOS only).
  • Accuracy: The distance of the beacon device, in meters.

# 3. Note

  • The beacon-related interface can be used directly, without the need to use wx.openBluetoothAdapter
  • Since beacons can be used to locate, they can only be used when WeChat has systematic location permissions.