0.7.2 hotfixes for autobugs

This commit is contained in:
geeksville 2020-06-08 14:19:49 -07:00
parent 303fb86aa6
commit c0ada64653
3 changed files with 16 additions and 7 deletions

View file

@ -443,9 +443,11 @@ class MeshService : Service(), Logging {
val wantForeground = RadioInterfaceService.getBondedDeviceAddress(this) != null
info("Requesting foreground service=$wantForeground")
if (wantForeground)
startForeground(notifyId, createNotification())
else
// We always start foreground because that's how our service is always started (if we didn't then android would kill us)
// but if we don't really need forground we immediately stop it.
startForeground(notifyId, createNotification())
if (!wantForeground)
stopForeground(true)
}