diff --git a/app/src/main/java/eu/faircode/email/EntityOperation.java b/app/src/main/java/eu/faircode/email/EntityOperation.java index a750f116cf..cf313d2c50 100644 --- a/app/src/main/java/eu/faircode/email/EntityOperation.java +++ b/app/src/main/java/eu/faircode/email/EntityOperation.java @@ -20,7 +20,6 @@ package eu.faircode.email; */ import android.content.Context; -import android.content.Intent; import android.content.SharedPreferences; import android.preference.PreferenceManager; @@ -115,7 +114,7 @@ public class EntityOperation { db.folder().setFolderSyncState(fid, "requested"); if (folder.account == null) // Outbox - context.startService(new Intent(context, ServiceSend.class)); + ServiceSend.start(context); Log.i("Queued sync folder=" + folder); } @@ -227,7 +226,7 @@ public class EntityOperation { db.message().setMessageUiHide(message.id, true); else if (SEND.equals(name)) - context.startService(new Intent(context, ServiceSend.class)); + ServiceSend.start(context); } catch (JSONException ex) { Log.e(ex); } diff --git a/app/src/main/java/eu/faircode/email/ReceiverAutostart.java b/app/src/main/java/eu/faircode/email/ReceiverAutostart.java index 5d89fb5f2e..0687f42fed 100644 --- a/app/src/main/java/eu/faircode/email/ReceiverAutostart.java +++ b/app/src/main/java/eu/faircode/email/ReceiverAutostart.java @@ -51,7 +51,7 @@ public class ReceiverAutostart extends BroadcastReceiver { return; if (db.operation().getOperations(outbox.id).size() > 0) - context.startService(new Intent(context, ServiceSend.class)); + ServiceSend.start(context); } catch (Throwable ex) { Log.e(ex); diff --git a/app/src/main/java/eu/faircode/email/ServiceSend.java b/app/src/main/java/eu/faircode/email/ServiceSend.java index 9a5a929a7d..d6a8caaa20 100644 --- a/app/src/main/java/eu/faircode/email/ServiceSend.java +++ b/app/src/main/java/eu/faircode/email/ServiceSend.java @@ -412,4 +412,8 @@ public class ServiceSend extends LifecycleService { db.identity().setIdentityState(ident.id, null); } } + + static void start(Context context) { + context.startService(new Intent(context, ServiceSend.class)); + } }