start DummyService only if there is Notification ready

This commit is contained in:
Milos Kozak 2019-06-29 10:59:10 +02:00
parent 6ccf3788be
commit df2ae1c52f

View file

@ -112,10 +112,11 @@ public class PersistentNotificationPlugin extends PluginBase {
} }
private void triggerNotificationUpdate() { private void triggerNotificationUpdate() {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) if (updateNotification() != null)
MainApp.instance().startForegroundService(new Intent(MainApp.instance(), DummyService.class)); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O)
else MainApp.instance().startForegroundService(new Intent(MainApp.instance(), DummyService.class));
MainApp.instance().startService(new Intent(MainApp.instance(), DummyService.class)); else
MainApp.instance().startService(new Intent(MainApp.instance(), DummyService.class));
} }
Notification updateNotification() { Notification updateNotification() {