diff --git a/app/src/main/java/eu/faircode/email/ApplicationEx.java b/app/src/main/java/eu/faircode/email/ApplicationEx.java index ee7093a83b..cb34df4c09 100644 --- a/app/src/main/java/eu/faircode/email/ApplicationEx.java +++ b/app/src/main/java/eu/faircode/email/ApplicationEx.java @@ -136,10 +136,6 @@ public class ApplicationEx extends Application implements SharedPreferences.OnSh DisconnectBlacklist.init(this); - ServiceSynchronize.boot(this); - ServiceSend.boot(this); - ServiceUI.boot(this); - boolean watchdog = prefs.getBoolean("watchdog", true); boolean enabled = prefs.getBoolean("enabled", true); if (watchdog && enabled) diff --git a/app/src/main/java/eu/faircode/email/ReceiverAutoStart.java b/app/src/main/java/eu/faircode/email/ReceiverAutoStart.java index 22d4ea3fb7..2b6aecca13 100644 --- a/app/src/main/java/eu/faircode/email/ReceiverAutoStart.java +++ b/app/src/main/java/eu/faircode/email/ReceiverAutoStart.java @@ -26,12 +26,16 @@ import android.content.Intent; public class ReceiverAutoStart extends BroadcastReceiver { @Override public void onReceive(final Context context, Intent intent) { - Log.i("Received " + intent); + if (Intent.ACTION_BOOT_COMPLETED.equals(intent.getAction()) || + Intent.ACTION_MY_PACKAGE_REPLACED.equals(intent.getAction())) { + Log.i("Received " + intent); - if (Intent.ACTION_BOOT_COMPLETED.equals(intent.getAction())) - ; // handled by Application + if (Intent.ACTION_MY_PACKAGE_REPLACED.equals(intent.getAction())) + ApplicationEx.upgrade(context); - if (Intent.ACTION_MY_PACKAGE_REPLACED.equals(intent.getAction())) - ApplicationEx.upgrade(context); + ServiceSynchronize.boot(context); + ServiceSend.boot(context); + ServiceUI.boot(context); + } } }