You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The app has BLE permissions declared in AndroidManifest.xml, but doesn't check at runtime if permissions are granted before scanning. This could cause crashes or unexpected behavior.
Current State: Permissions declared ✅ but no runtime checks ❌
Required Permissions (Android)
BLUETOOTH_SCAN
BLUETOOTH_CONNECT
ACCESS_FINE_LOCATION (required for BLE scanning on Android <12)
Suggested Implementation
// Add permission_handler to pubspec.yaml
dependencies:
permission_handler:^11.0.0// In OmiBluetoothServiceFuture<bool> _checkBlePermissions() async {
if (!Platform.isAndroid) {
returntrue; // iOS handles via Info.plist
}
final scanGranted =awaitPermission.bluetoothScan.isGranted;
final connectGranted =awaitPermission.bluetoothConnect.isGranted;
if (!scanGranted ||!connectGranted) {
debugPrint('[OmiBluetoothService] BLE permissions not granted');
// Request permissionsfinal status =await [
Permission.bluetoothScan,
Permission.bluetoothConnect,
].request();
return status[Permission.bluetoothScan]!.isGranted &&
status[Permission.bluetoothConnect]!.isGranted;
}
returntrue;
}
// Call before scanningFuture<void> scanForDevices({...}) async {
final hasPermissions =await_checkBlePermissions();
if (!hasPermissions) {
throwException('BLE permissions not granted');
}
// ... continue with scan
}
Problem
The app has BLE permissions declared in
AndroidManifest.xml, but doesn't check at runtime if permissions are granted before scanning. This could cause crashes or unexpected behavior.Current State: Permissions declared ✅ but no runtime checks ❌
Required Permissions (Android)
BLUETOOTH_SCANBLUETOOTH_CONNECTACCESS_FINE_LOCATION(required for BLE scanning on Android <12)Suggested Implementation
Benefits
Priority
High - Required for production Android app
Related