File tree Expand file tree Collapse file tree 1 file changed +13
-4
lines changed
android/app/src/main/java/betaflight/configurator/protocols/bluetooth Expand file tree Collapse file tree 1 file changed +13
-4
lines changed Original file line number Diff line number Diff line change @@ -492,10 +492,19 @@ public void onScanFailed(int errorCode) {
492492 }
493493 };
494494
495- bluetoothLeScanner .startScan (filters .isEmpty () ? null : filters , settings , activeScanCallback );
496-
497- scanTimeoutRunnable = () -> rejectPendingScan ("Scan timed out" );
498- mainHandler .postDelayed (scanTimeoutRunnable , timeoutMs );
495+ try {
496+ bluetoothLeScanner .startScan (
497+ filters .isEmpty () ? null : filters ,
498+ settings ,
499+ activeScanCallback
500+ );
501+ } catch (SecurityException ex ) {
502+ Log .e (TAG , "Bluetooth LE scan failed due to missing permissions" , ex );
503+ rejectPendingScan ("Bluetooth scan permission denied" );
504+ return ;
505+ }
506+ scanTimeoutRunnable = () -> rejectPendingScan ("Scan timed out" );
507+ mainHandler .postDelayed (scanTimeoutRunnable , timeoutMs );
499508 }
500509
501510 private void handleScanResult (ScanResult result , ScanCriteria criteria ) {
You can’t perform that action at this time.
0 commit comments