diff --git a/app/src/main/java/eu/faircode/email/ServiceSynchronize.java b/app/src/main/java/eu/faircode/email/ServiceSynchronize.java index e20e0d69ad..1ace9f8552 100644 --- a/app/src/main/java/eu/faircode/email/ServiceSynchronize.java +++ b/app/src/main/java/eu/faircode/email/ServiceSynchronize.java @@ -201,8 +201,13 @@ public class ServiceSynchronize extends ServiceBase implements SharedPreferences if (isBackgroundService(this)) stopForeground(true); else - startForeground(NotificationHelper.NOTIFICATION_SYNCHRONIZE, - getNotificationService(null, null)); + try { + startForeground(NotificationHelper.NOTIFICATION_SYNCHRONIZE, + getNotificationService(null, null)); + } catch (Throwable ex) { + Log.e(ex); + stopSelf(); + } isOptimizing = Boolean.FALSE.equals(Helper.isIgnoringOptimizations(this));