Provides classes that manage Bluetooth functionality, such as scanning for devices, connecting with devices, and managing data transfer between devices. The Bluetooth API supports both "Classic Bluetooth" and Bluetooth Low Energy.
The Bluetooth APIs let applications:
- Scan for other Bluetooth devices (including BLE devices).
- Query the local Bluetooth adapter for paired Bluetooth devices.
- Establish RFCOMM channels/sockets.
- Connect to specified sockets on other devices.
- Transfer data to and from other devices.
- Communicate with BLE devices, such as proximity sensors, heart rate monitors, fitness devices, and so on.
- Act as a GATT client or a GATT server (BLE).
To perform Bluetooth communication using these APIs, an application must declare the
Some additional functionality, such as requesting device discovery, also requires the
- This method was deprecated in API level 21.
startScan(List, ScanSettings, ScanCallback)instead.
Starts a scan for Bluetooth LE devices.
Results of the scan are reported using the
onLeScan(BluetoothDevice, int, byte)callback.
Starts a scan for Bluetooth LE devices, looking for devices that advertise given services.
Devices which advertise all specified services are reported using the
int, byte) callback.
public abstract void onLeScan (BluetoothDevice device, int rssi, byte scanRecord)Callback reporting an LE device found during a device scan initiated by the