scanDevices

Scans for nearby BLE devices and emits discovered devices through a Flow.

This method filters results to only include BLE devices (excluding Classic Bluetooth) and removes duplicates based on device address. The scan continues until the Flow is cancelled by the collector.

Requires BLUETOOTH_SCAN permission on Android 12+ or ACCESS_FINE_LOCATION on earlier versions.

Return

A Flow emitting unique BluetoothDevice instances as they are discovered.

See also

Throws

if required Bluetooth permissions are not granted.