Bluetooth LE devices can broadcast messages to other devices. That message packet can include informations like length, profile, rssi (signal strength), etc.
How can I read those Bluetooth LE broadcast data when scanning for BLE devices in Android?
API Levels 21+
In android.bluetooth.le.ScanCallback , the callback method as follows has a parameter named result , which has a field called scanRecord , with should contain the advertisement data sent by a BLE device.
void onScanResult (int callbackType, ScanResult result)
API Levels 18-20
In BluetoothAdapter.LeScanCallback , the callback method as follows has a parameter named scanRecord , which should contain the advertisement data sent by a BLE device.
public abstract void onLeScan (BluetoothDevice device, int rssi, byte[] scanRecord)
scanRecord: The content of the advertisement record offered by the remote device.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.