mirror of
https://codeberg.org/Freeyourgadget/Gadgetbridge
synced 2024-11-08 19:27:04 +01:00
Fix crash when nearby devices (BLUETOOTH_SCAN) permission is missing
This commit is contained in:
parent
6bfd3dcd06
commit
cae6f5d73e
@ -1214,7 +1214,11 @@ public class DeviceCommunicationService extends Service implements SharedPrefere
|
||||
|
||||
private void startForeground() {
|
||||
GB.createNotificationChannels(this);
|
||||
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q) {
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.UPSIDE_DOWN_CAKE && ContextCompat.checkSelfPermission(this, Manifest.permission.BLUETOOTH_SCAN) == PackageManager.PERMISSION_DENIED)
|
||||
return;
|
||||
|
||||
startForeground(GB.NOTIFICATION_ID, GB.createNotification(getString(R.string.gadgetbridge_running), this), ServiceInfo.FOREGROUND_SERVICE_TYPE_CONNECTED_DEVICE);
|
||||
} else {
|
||||
startForeground(GB.NOTIFICATION_ID, GB.createNotification(getString(R.string.gadgetbridge_running), this));
|
||||
|
Loading…
Reference in New Issue
Block a user