DummyService has nonNull notification
This commit is contained in:
parent
b2c46b67b6
commit
3dc5c61984
1 changed files with 3 additions and 4 deletions
|
@ -31,6 +31,7 @@ public class DummyService extends Service {
|
||||||
@Override
|
@Override
|
||||||
public int onStartCommand(Intent intent, int flags, int startId) {
|
public int onStartCommand(Intent intent, int flags, int startId) {
|
||||||
super.onStartCommand(intent, flags, startId);
|
super.onStartCommand(intent, flags, startId);
|
||||||
|
startForeground(PersistentNotificationPlugin.ONGOING_NOTIFICATION_ID, PersistentNotificationPlugin.getPlugin().updateNotification());
|
||||||
return START_STICKY;
|
return START_STICKY;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -45,11 +46,9 @@ public class DummyService extends Service {
|
||||||
@Override
|
@Override
|
||||||
public void onCreate() {
|
public void onCreate() {
|
||||||
super.onCreate();
|
super.onCreate();
|
||||||
|
// TODO: I guess this was moved here in order to adhere to the 5 seconds rule to call "startForeground" after a Service was called as Foreground service?
|
||||||
|
// As onCreate() is not called every time a service is started, copied to onStartCommand().
|
||||||
Notification notification = PersistentNotificationPlugin.getPlugin().updateNotification();
|
Notification notification = PersistentNotificationPlugin.getPlugin().updateNotification();
|
||||||
if (notification == null) {
|
|
||||||
log.debug("notification==null");
|
|
||||||
notification = new Notification();
|
|
||||||
}
|
|
||||||
startForeground(PersistentNotificationPlugin.ONGOING_NOTIFICATION_ID, notification);
|
startForeground(PersistentNotificationPlugin.ONGOING_NOTIFICATION_ID, notification);
|
||||||
MainApp.bus().register(this);
|
MainApp.bus().register(this);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue