RL: prevent crash with BT off
This commit is contained in:
parent
6c604e923f
commit
656e3e44be
1 changed files with 5 additions and 3 deletions
|
@ -219,11 +219,13 @@ class RileyLinkBLEConfigActivity : TranslatedDaggerAppCompatActivity() {
|
||||||
}
|
}
|
||||||
scanning = true
|
scanning = true
|
||||||
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.S || ActivityCompat.checkSelfPermission(this, Manifest.permission.BLUETOOTH_SCAN) == PackageManager.PERMISSION_GRANTED) {
|
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.S || ActivityCompat.checkSelfPermission(this, Manifest.permission.BLUETOOTH_SCAN) == PackageManager.PERMISSION_GRANTED) {
|
||||||
|
if (bluetoothAdapter?.isEnabled == true && bluetoothAdapter?.state == BluetoothAdapter.STATE_ON) {
|
||||||
bleScanner?.startScan(filters, settings, bleScanCallback)
|
bleScanner?.startScan(filters, settings, bleScanCallback)
|
||||||
aapsLogger.debug(LTag.PUMPBTCOMM, "startLeDeviceScan: Scanning Start")
|
aapsLogger.debug(LTag.PUMPBTCOMM, "startLeDeviceScan: Scanning Start")
|
||||||
Toast.makeText(this@RileyLinkBLEConfigActivity, R.string.riley_link_ble_config_scan_scanning, Toast.LENGTH_SHORT).show()
|
Toast.makeText(this@RileyLinkBLEConfigActivity, R.string.riley_link_ble_config_scan_scanning, Toast.LENGTH_SHORT).show()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private fun stopLeDeviceScan() {
|
private fun stopLeDeviceScan() {
|
||||||
if (scanning) {
|
if (scanning) {
|
||||||
|
|
Loading…
Reference in a new issue