# Bluetooth beacon (Beacon)
Base library 1.2.0 Start supporting.
Bluetooth beacon (Beacon) Is built on theBluetooth Low Energy (BLE) A broadcast protocol based on the protocol.
Beacon As the peripheral equipment in the Bluetooth Low Power Protocol, the device continuously broadcasts the specific packet containing the device identification to the surrounding, but can not establish a connection with the central device. The device that the Mini Program runs as the central device that can receive Beacon Equipment broadcast package, to achieve data interaction. Commonly used in indoor positioning, message push and other scenarios.
In Mini programs, the developer can use the wx.startBeaconDiscovery Start Search Beacon Equipment, and through the [wx.onBeaconUpdate ]((wx.onBeaconUpdate )) Receive device update events.
# 1. Equipment identification
Each Beacon The broadcast packet of the device carries at least the following information, which together constitute the unique identifier of the device.
- UUID (16 byte):128 Bit UUID, used to uniquely identify a series of beacon devices identified by the Mini Program.
- major (2 byte):0 - 65535 Of unsigned integers that can be used to distinguish between the same UUID A group of equipment.
- minor (2 byte):0 - 65535 Of unsigned integers that can be used to distinguish between those with the same UUID and major Of the equipment.
# 2. Equipment status
When the Mini Program receives Beacon When the device signals, the following information is also provided
- rssi: Signal strength, in units of dBm。
- proximity: Beacon Enumeration value that identifies the device distance (only iOS)。
- accuracy: Beacon The distance of the equipment, in meters.
# 3. Note
- Beacon The relevant interface can be used directly, without the need to use wx.openBluetoothAdapter Initialize the Bluetooth Adapter Module
- Because Beacon It can be used to locate, so it requires WeChat to have systematic location permissions.