DefaultScanner

A default implementation of BaseScanner

Parameters

applicationContext

the Context in which Bluetooth should run

bluetoothScanner

the BluetoothLeScannerCompat to use for scanning

bluetoothAdapter

the BluetoothAdapter to use to access Bluetooth

scanSettings

the ScanSettings to apply to the scanner

settings

the BaseScanner.Settings to configure this scanner

coroutineScope

the CoroutineScope this scanner runs on

scanningDispatcher

the CoroutineDispatcher to which scanning should be dispatched. It is recommended to make this a dispatcher that can handle high frequency of events

A default implementation of BaseScanner

Parameters

scanSettings

the ScanSettings to configure this scanner

settings

the BaseScanner.Settings to configure this scanner

coroutineScope

the CoroutineScope this scanner runs on

scanningDispatcher

the CoroutineDispatcher to which scanning should be dispatched. It is recommended to make this a dispatcher that can handle high frequency of events

A default implementation of BaseScanner

A default implementation of BaseScanner

Parameters

scanSettings

the ScanSettings to configure this scanner

settings

the BaseScanner.Settings to configure this scanner

coroutineScope

the CoroutineScope this scanner runs on

scanningDispatcher

the CoroutineDispatcher to which scanning should be dispatched. It is recommended to make this a dispatcher that can handle high frequency of events

A default implementation of BaseScanner backed by the Web Bluetooth API.

Web Bluetooth has no free-running scan, and navigator.bluetooth.requestDevice requires transient user activation. This scanner therefore renders an "Add Device" overlay for the duration of a scan (didStartScanning shows it, didStopScanning removes it); each press of its button opens the system picker and adds the chosen device, so a single scan can collect any number of devices.

Parameters

settings

the BaseScanner.Settings to configure this scanner

coroutineScope

the CoroutineScope this scanner runs on

scanningDispatcher

the CoroutineDispatcher to which scanning should be dispatched

optionalServices

the advertisement-independent access allowlist applied to every picker invocation

pickerSettings

the WebDevicePickerSettings configuring the "Add Device" overlay

Types

Link copied to clipboard
class Builder(applicationContext: Context = ApplicationHolder.applicationContext, bluetoothScanner: BluetoothLeScannerCompat = BluetoothLeScannerCompat.getScanner(), bluetoothAdapter: BluetoothAdapter? = (applicationContext.getSystemService(Context.BLUETOOTH_SERVICE) as? BluetoothManager)?.adapter, scanSettings: ScanSettings = defaultScanSettings) : BaseScanner.Builder

Builder for creating a DefaultScanner

class Builder(scanSettings: DefaultScanner.ScanSettings = ScanSettings.defaultScanOptions) : BaseScanner.Builder

Builder for creating a DefaultScanner

class Builder(scanSettings: DefaultScanner.ScanSettings = ScanSettings.defaultScanOptions) : BaseScanner.Builder

Builder for creating a DefaultScanner

class Builder(optionalServices: List<UUID> = emptyList(), pickerSettings: WebDevicePickerSettings = WebDevicePickerSettings()) : BaseScanner.Builder

Builder for creating a DefaultScanner

Link copied to clipboard
object Companion
Link copied to clipboard

Settings to configure a DefaultScanner

Settings to configure a DefaultScanner

Properties

Link copied to clipboard
open override val connectionEvents: Flow<Scanner.ConnectionEvent>

The Flow of all the ConnectionEvent detected by the scanner

open override val connectionEvents: Flow<Scanner.ConnectionEvent>

The Flow of all the ConnectionEvent detected by the scanner

open override val connectionEvents: Flow<Scanner.ConnectionEvent>

The Flow of all the ConnectionEvent detected by the scanner

open override val connectionEvents: Flow<Scanner.ConnectionEvent>

The Flow of all the ConnectionEvent detected by the scanner

open override val connectionEvents: Flow<Scanner.ConnectionEvent>

The Flow of all the ConnectionEvent detected by the scanner

coroutineContext
Link copied to clipboard
Link copied to clipboard

The Flow of all the DeviceDiscovered detected by the scanner. These are grouped in a list until collected to account for high volumes of events

The Flow of all the DeviceDiscovered detected by the scanner. These are grouped in a list until collected to account for high volumes of events

The Flow of all the DeviceDiscovered detected by the scanner. These are grouped in a list until collected to account for high volumes of events

The Flow of all the DeviceDiscovered detected by the scanner. These are grouped in a list until collected to account for high volumes of events

The Flow of all the DeviceDiscovered detected by the scanner. These are grouped in a list until collected to account for high volumes of events

Link copied to clipboard
open override val events: Flow<Scanner.Event>

The Flow of all the Event detected by the scanner

open override val events: Flow<Scanner.Event>

The Flow of all the Event detected by the scanner

open override val events: Flow<Scanner.Event>

The Flow of all the Event detected by the scanner

open override val events: Flow<Scanner.Event>

The Flow of all the Event detected by the scanner

open override val events: Flow<Scanner.Event>

The Flow of all the Event detected by the scanner

Link copied to clipboard
actual open override val isSupported: Boolean

Indicates whether the system supports Bluetooth scanning

actual open override val isSupported: Boolean = true

Indicates whether the system supports Bluetooth scanning

expect open override val isSupported: Boolean

Indicates whether the system supports Bluetooth scanning

actual open override val isSupported: Boolean = true

Indicates whether the system supports Bluetooth scanning

actual open override val isSupported: Boolean

Indicates whether the system supports Bluetooth scanning

Functions

Link copied to clipboard
open override fun cancelRetrievingPairedDevices()
open override fun cancelRetrievingPairedDevices()
open override fun cancelRetrievingPairedDevices()
open override fun cancelRetrievingPairedDevices()
open override fun cancelRetrievingPairedDevices()
Link copied to clipboard
open suspend override fun isHardwareEnabled(): Boolean

Checks whether the Bluetooth service is currently enabled

open suspend override fun isHardwareEnabled(): Boolean

Checks whether the Bluetooth service is currently enabled

open suspend override fun isHardwareEnabled(): Boolean

Checks whether the Bluetooth service is currently enabled

open suspend override fun isHardwareEnabled(): Boolean

Checks whether the Bluetooth service is currently enabled

open suspend override fun isHardwareEnabled(): Boolean

Checks whether the Bluetooth service is currently enabled

Link copied to clipboard
open suspend override fun requestEnableHardware()

Attempts to request the user to enable Bluetooth

open suspend override fun requestEnableHardware()

Attempts to request the user to enable Bluetooth

open suspend override fun requestEnableHardware()

Attempts to request the user to enable Bluetooth

open suspend override fun requestEnableHardware()

Attempts to request the user to enable Bluetooth

open suspend override fun requestEnableHardware()

Attempts to request the user to enable Bluetooth

Link copied to clipboard
open suspend override fun retrievePairedDevices(withServices: Filter, removeForAllPairedFilters: Boolean, connectionSettings: ConnectionSettings?)

Retrieves the list of paired ConnectableDevice This will result in Event.PairedDevicesRetrieved on the events flow

open suspend override fun retrievePairedDevices(withServices: Filter, removeForAllPairedFilters: Boolean, connectionSettings: ConnectionSettings?)

Retrieves the list of paired ConnectableDevice This will result in Event.PairedDevicesRetrieved on the events flow

open suspend override fun retrievePairedDevices(withServices: Filter, removeForAllPairedFilters: Boolean, connectionSettings: ConnectionSettings?)

Retrieves the list of paired ConnectableDevice This will result in Event.PairedDevicesRetrieved on the events flow

open suspend override fun retrievePairedDevices(withServices: Filter, removeForAllPairedFilters: Boolean, connectionSettings: ConnectionSettings?)

Retrieves the list of paired ConnectableDevice This will result in Event.PairedDevicesRetrieved on the events flow

open suspend override fun retrievePairedDevices(withServices: Filter, removeForAllPairedFilters: Boolean, connectionSettings: ConnectionSettings?)

Retrieves the list of paired ConnectableDevice This will result in Event.PairedDevicesRetrieved on the events flow

Link copied to clipboard
suspend override fun scanForDevices(filter: Filter, connectionSettings: ConnectionSettings?)

Starts scanning for devices. This will result in Event.DeviceDiscovered or Event.FailedScanning

suspend override fun scanForDevices(filter: Filter, connectionSettings: ConnectionSettings?)

Starts scanning for devices. This will result in Event.DeviceDiscovered or Event.FailedScanning

suspend override fun scanForDevices(filter: Filter, connectionSettings: ConnectionSettings?)

Starts scanning for devices. This will result in Event.DeviceDiscovered or Event.FailedScanning

suspend override fun scanForDevices(filter: Filter, connectionSettings: ConnectionSettings?)

Starts scanning for devices. This will result in Event.DeviceDiscovered or Event.FailedScanning

suspend override fun scanForDevices(filter: Filter, connectionSettings: ConnectionSettings?)

Starts scanning for devices. This will result in Event.DeviceDiscovered or Event.FailedScanning

Link copied to clipboard
open suspend override fun startMonitoringHardwareEnabled()

Starts scanning for changes to the Bluetooth service being enabled This will result in Event.BluetoothEnabled or Event.BluetoothDisabled on the events flow

open suspend override fun startMonitoringHardwareEnabled()

Starts scanning for changes to the Bluetooth service being enabled This will result in Event.BluetoothEnabled or Event.BluetoothDisabled on the events flow

open suspend override fun startMonitoringHardwareEnabled()

Starts scanning for changes to the Bluetooth service being enabled This will result in Event.BluetoothEnabled or Event.BluetoothDisabled on the events flow

open suspend override fun startMonitoringHardwareEnabled()

Starts scanning for changes to the Bluetooth service being enabled This will result in Event.BluetoothEnabled or Event.BluetoothDisabled on the events flow

open suspend override fun startMonitoringHardwareEnabled()

Starts scanning for changes to the Bluetooth service being enabled This will result in Event.BluetoothEnabled or Event.BluetoothDisabled on the events flow

Link copied to clipboard
open suspend override fun startMonitoringPermissions()

Starts scanning for changes to permissions related to Bluetooth. This will result in Event.PermissionChanged on the events flow.

open suspend override fun startMonitoringPermissions()

Starts scanning for changes to permissions related to Bluetooth. This will result in Event.PermissionChanged on the events flow.

open suspend override fun startMonitoringPermissions()

Starts scanning for changes to permissions related to Bluetooth. This will result in Event.PermissionChanged on the events flow.

open suspend override fun startMonitoringPermissions()

Starts scanning for changes to permissions related to Bluetooth. This will result in Event.PermissionChanged on the events flow.

open suspend override fun startMonitoringPermissions()

Starts scanning for changes to permissions related to Bluetooth. This will result in Event.PermissionChanged on the events flow.

Link copied to clipboard
open suspend override fun stopMonitoringHardwareEnabled()

Stops scanning for changes to the Bluetooth service being enabled

open suspend override fun stopMonitoringHardwareEnabled()

Stops scanning for changes to the Bluetooth service being enabled

open suspend override fun stopMonitoringHardwareEnabled()

Stops scanning for changes to the Bluetooth service being enabled

open suspend override fun stopMonitoringHardwareEnabled()

Stops scanning for changes to the Bluetooth service being enabled

open suspend override fun stopMonitoringHardwareEnabled()

Stops scanning for changes to the Bluetooth service being enabled

Link copied to clipboard
open suspend override fun stopMonitoringPermissions()

Stops scanning for changes to permissions related to Bluetooth.

open suspend override fun stopMonitoringPermissions()

Stops scanning for changes to permissions related to Bluetooth.

open suspend override fun stopMonitoringPermissions()

Stops scanning for changes to permissions related to Bluetooth.

open suspend override fun stopMonitoringPermissions()

Stops scanning for changes to permissions related to Bluetooth.

open suspend override fun stopMonitoringPermissions()

Stops scanning for changes to permissions related to Bluetooth.

Link copied to clipboard
suspend override fun stopScanning()

Stops scanning for devices

suspend override fun stopScanning()

Stops scanning for devices

suspend override fun stopScanning()

Stops scanning for devices

suspend override fun stopScanning()

Stops scanning for devices

suspend override fun stopScanning()

Stops scanning for devices