8

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?

Eldhose M Babu
  • 14,382
  • 8
  • 39
  • 44
vky
  • 105
  • 1
  • 2
  • 7
  • 1
    U can understand like that .. Bluetooth device contains some advertisement data that data contains its Mac-id,nameand the header part ... So I have to read that raw data – vky Oct 05 '12 at 06:19
  • 1
    Are you talking about Bluetooth Low Energy (SMART) Advertising packets or Bluetooth BR/EDR paging/inquiry e.g Extended Inquiry messages? – Simon Peverett Oct 08 '12 at 08:38
  • yes Pev Iam talking about BLE advertising packets which contains some data.. – vky Oct 09 '12 at 07:22

1 Answers1

8

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.

Bryan Bryce
  • 1,310
  • 1
  • 16
  • 29
Jason H
  • 369
  • 5
  • 5