File tree Expand file tree Collapse file tree 2 files changed +18
-5
lines changed
java/betaflight/configurator/protocols/ble Expand file tree Collapse file tree 2 files changed +18
-5
lines changed Original file line number Diff line number Diff line change 5757 <uses-permission android : name =" android.permission.INTERNET" />
5858 <uses-permission android : name =" android.permission.BLUETOOTH" android : maxSdkVersion =" 30" />
5959 <uses-permission android : name =" android.permission.BLUETOOTH_ADMIN" android : maxSdkVersion =" 30" />
60- <uses-permission android : name =" android.permission.ACCESS_COARSE_LOCATION" />
60+ <uses-permission android : name =" android.permission.ACCESS_COARSE_LOCATION" android : maxSdkVersion = " 30 " />
6161 <uses-permission
6262 android : name =" android.permission.BLUETOOTH_SCAN"
63+ android : minSdkVersion =" 31"
6364 android : usesPermissionFlags =" neverForLocation" />
6465 <uses-permission
65- android : name =" android.permission.BLUETOOTH_CONNECT" />
66+ android : name =" android.permission.BLUETOOTH_CONNECT"
67+ android : minSdkVersion =" 31" />
6668
6769 <!-- USB Host feature -->
6870 <uses-feature android : name =" android.hardware.usb.host" android : required =" true" />
Original file line number Diff line number Diff line change 4747@ CapacitorPlugin (
4848 name = "BetaflightBle" ,
4949 permissions = {
50+ // Android 12+ BLE permissions
5051 @ Permission (
5152 strings = {
5253 Manifest .permission .BLUETOOTH_SCAN ,
53- Manifest .permission .BLUETOOTH_CONNECT ,
54- Manifest .permission .ACCESS_COARSE_LOCATION
54+ Manifest .permission .BLUETOOTH_CONNECT
5555 },
5656 alias = "bluetooth"
57+ ),
58+ // Pre-Android 12 location-based BLE permission
59+ @ Permission (
60+ strings = {
61+ Manifest .permission .ACCESS_COARSE_LOCATION
62+ },
63+ alias = "bluetoothLegacy"
5764 )
5865 }
5966)
@@ -127,7 +134,11 @@ private boolean ensurePermissions(PluginCall call) {
127134 return true ;
128135 }
129136
130- requestPermissionForAlias ("bluetooth" , call , "onBlePermissionResult" );
137+ if (Build .VERSION .SDK_INT >= Build .VERSION_CODES .S ) {
138+ requestPermissionForAlias ("bluetooth" , call , "onBlePermissionResult" );
139+ } else {
140+ requestPermissionForAlias ("bluetoothLegacy" , call , "onBlePermissionResult" );
141+ }
131142 return false ;
132143 }
133144
You can’t perform that action at this time.
0 commit comments