From 6ccf3788beb9cfac7f348015a4414b1b8a57cde2 Mon Sep 17 00:00:00 2001 From: Milos Kozak Date: Thu, 27 Jun 2019 22:05:22 +0200 Subject: [PATCH] fix dummy service start --- .../general/persistentNotification/DummyService.java | 8 +++++--- 1 file changed, 5 insertions(+), 3 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 4ad576615c..c15122d03d 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 @@ -29,9 +29,7 @@ public class DummyService extends Service { @Override public int onStartCommand(Intent intent, int flags, int startId) { - Notification notification = PersistentNotificationPlugin.getPlugin().updateNotification(); - if (notification != null) - startForeground(PersistentNotificationPlugin.ONGOING_NOTIFICATION_ID, notification); + super.onStartCommand(intent, flags, startId); return START_STICKY; } @@ -45,6 +43,10 @@ public class DummyService extends Service { @Override public void onCreate() { + super.onCreate(); + Notification notification = PersistentNotificationPlugin.getPlugin().updateNotification(); + if (notification != null) + startForeground(PersistentNotificationPlugin.ONGOING_NOTIFICATION_ID, notification); MainApp.bus().register(this); }