BleScanner

class BleScanner(context: Context)

Wrapper class for the native Android API. It has a single function that returns a flow that continuously emits single scan items.

Parameters

context

Android context required to initialize native Android API

Constructors

Link copied to clipboard
constructor(context: Context)

Initialize scanner's components.

Functions

Link copied to clipboard
@RequiresPermission(allOf = ["android.permission.BLUETOOTH_SCAN", "android.permission.BLUETOOTH_CONNECT"])
fun scan(filters: List<BleScanFilter> = emptyList(), settings: BleScannerSettings = BleScannerSettings()): Flow<BleScanResult>

Starts scanning and emit results in the Flow. Automatically stops scanning when CoroutineScope of the Flow is closed.