diff --git a/src/org/thoughtcrime/securesms/connect/KeepAliveService.java b/src/org/thoughtcrime/securesms/connect/KeepAliveService.java index 02860b687..c2b174472 100644 --- a/src/org/thoughtcrime/securesms/connect/KeepAliveService.java +++ b/src/org/thoughtcrime/securesms/connect/KeepAliveService.java @@ -56,7 +56,15 @@ public class KeepAliveService extends Service { // there's nothing more to do here as all initialisation stuff is already done in // ApplicationLoader.onCreate() which is called before this broadcast is sended. s_this = this; - setSelfAsForeground(); + + // set self as foreground + try { + stopForeground(true); + startForeground(FG_NOTIFICATION_ID, createNotification()); + } + catch (Exception e) { + e.printStackTrace(); + } } @Override @@ -78,11 +86,6 @@ public class KeepAliveService extends Service { // the service will be restarted due to START_STICKY automatically, there's nothing more to do. } - private void setSelfAsForeground() { - stopForeground(true); - startForeground(FG_NOTIFICATION_ID, createNotification()); - } - static public KeepAliveService getInstance() { return s_this; // may be null