fix: avoid starting FGS with location type without permission

This commit is contained in:
andrekir 2024-09-14 18:24:23 -03:00
parent c536679762
commit ac928b40d4

View file

@ -291,7 +291,11 @@ class MeshService : Service(), Logging {
serviceNotifications.notifyId,
notification,
if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.Q) {
ServiceInfo.FOREGROUND_SERVICE_TYPE_MANIFEST
if (hasLocationPermission()) {
ServiceInfo.FOREGROUND_SERVICE_TYPE_MANIFEST
} else {
ServiceInfo.FOREGROUND_SERVICE_TYPE_CONNECTED_DEVICE
}
} else {
0
},