range

abstract fun range(peripheral: P, timeout: Duration = Duration.INFINITE): Flow<RangeEvent<P>>

Starts ranging for Bluetooth LE devices.

This method can be started when monitor reports PeripheralEnteredRange event for given peripheral.

The flow is closed automatically when the peripheral leaves range of the monitoring device.

Parameters

peripheral

The peripheral to range.

timeout

The scan duration. By default the scan will run until the flow is closed.

Throws

If the central manager has been closed.

If Bluetooth is disabled or not available.

If the permission to scan is denied.

If an error occurred while starting the scan.