Kotlin Android BLE с использованием nordicsemi не может получить устройства BLE ⇐ Android
Kotlin Android BLE с использованием nordicsemi не может получить устройства BLE
I cannot get BLE devices.
For scan devices, I use no.nordicsemi.android.kotlin.ble:scanner:1.0.6
I call startBleScanning in the ViewModel.
Code:
val btDevicesLiveData = MutableLiveData() private val aggregator = BleScanResultAggregator() fun startBleScanning(context: Context) { BleScanner(context).scan() .map { aggregator.aggregateDevices(it) } .onEach { btDevicesLiveData.postValue(it.map { device -> Log.d("BT", "result: ${device.address}") }) } .launchIn(viewModelScope) } In log, I see paired devices only.
Bluetooth on my phone is enabled. The device is enabled too.
How can I get BLE devices?
Источник: https://stackoverflow.com/questions/773 ... le-devices
I cannot get BLE devices.
For scan devices, I use no.nordicsemi.android.kotlin.ble:scanner:1.0.6
I call startBleScanning in the ViewModel.
Code:
val btDevicesLiveData = MutableLiveData() private val aggregator = BleScanResultAggregator() fun startBleScanning(context: Context) { BleScanner(context).scan() .map { aggregator.aggregateDevices(it) } .onEach { btDevicesLiveData.postValue(it.map { device -> Log.d("BT", "result: ${device.address}") }) } .launchIn(viewModelScope) } In log, I see paired devices only.
Bluetooth on my phone is enabled. The device is enabled too.
How can I get BLE devices?
Источник: https://stackoverflow.com/questions/773 ... le-devices
-
- Похожие темы
- Ответы
- Просмотры
- Последнее сообщение