Start foreground on create

Sometimes there is a significant delay between on create and on start command
This commit is contained in:
M66B
2019-07-30 08:46:38 +02:00
parent eaf3ea4a7c
commit 954c8db225
3 changed files with 8 additions and 7 deletions

View File

@@ -36,11 +36,15 @@ public class ServiceExternal extends Service {
// adb shell am startservice -a eu.faircode.email.DISABLE
@Override
public void onCreate() {
super.onCreate();
startForeground(Helper.NOTIFICATION_EXTERNAL, getNotification().build());
}
@Override
public int onStartCommand(Intent intent, int flags, int startId) {
try {
startForeground(Helper.NOTIFICATION_EXTERNAL, getNotification().build());
Log.i("Received intent=" + intent);
Log.logExtras(intent);