From 1512064c53c97d7e7889312d0807b100e1694804 Mon Sep 17 00:00:00 2001 From: Milos Kozak Date: Sat, 29 Jun 2019 12:49:29 +0200 Subject: [PATCH] always run startForeground() --- .../general/persistentNotification/DummyService.java | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/general/persistentNotification/DummyService.java b/app/src/main/java/info/nightscout/androidaps/plugins/general/persistentNotification/DummyService.java index c15122d03d..1d287ca338 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/general/persistentNotification/DummyService.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/general/persistentNotification/DummyService.java @@ -4,6 +4,7 @@ import android.app.Notification; import android.app.Service; import android.content.Intent; import android.os.IBinder; + import androidx.annotation.Nullable; import com.squareup.otto.Subscribe; @@ -45,8 +46,11 @@ public class DummyService extends Service { public void onCreate() { super.onCreate(); Notification notification = PersistentNotificationPlugin.getPlugin().updateNotification(); - if (notification != null) - startForeground(PersistentNotificationPlugin.ONGOING_NOTIFICATION_ID, notification); + if (notification == null) { + log.debug("notification==null"); + notification = new Notification(); + } + startForeground(PersistentNotificationPlugin.ONGOING_NOTIFICATION_ID, notification); MainApp.bus().register(this); }