scan

@RequiresPermission(anyOf = ["android.permission.BLUETOOTH_ADMIN", "android.permission.BLUETOOTH_SCAN"])
suspend fun scan(filters: List<ScanFilter>? = null, settings: ScanSettings? = null, duration: Long = DEFAULT_TIMEOUT): Array<BLEDevice>

Starts a scan for bluetooth devices Only runs with a duration defined

If only one device is required consider using scanFor

Return

An Array of Bluetooth devices found

Parameters

filters

Used to specify attributes of the devices on the scan

settings

Native object to specify the scan settings (The default setting is only recommended for really fast scans)

duration

Scan time limit, when exceeded stops the scan (Ignored when less then 0)

See also

For a variation using callbacks

Throws

When a duration is not defined

When an error occurs