mirror of
https://github.com/M66B/FairEmail.git
synced 2026-04-09 02:23:38 +02:00
Run start service on foreground
This commit is contained in:
@@ -2023,7 +2023,16 @@ public class ServiceSynchronize extends ServiceBase implements SharedPreferences
|
||||
prefs.edit().putInt("poll_interval", OPTIMIZE_POLL_INTERVAL).apply();
|
||||
} else if (pollInterval <= 60 && account.poll_exempted) {
|
||||
db.account().setAccountPollExempted(account.id, false);
|
||||
ServiceSynchronize.eval(this, "Optimize=" + reason);
|
||||
ApplicationEx.getMainHandler().post(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
try {
|
||||
onEval(new Intent().putExtra("account", account.id));
|
||||
} catch (Throwable ex) {
|
||||
Log.e(ex);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2432,12 +2441,13 @@ public class ServiceSynchronize extends ServiceBase implements SharedPreferences
|
||||
private static void start(Context context, Intent intent) {
|
||||
if (isBackgroundService(context))
|
||||
context.startService(intent);
|
||||
else
|
||||
else {
|
||||
try {
|
||||
ContextCompat.startForegroundService(context, intent);
|
||||
} catch (Throwable ex) {
|
||||
Log.e(ex);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static boolean isBackgroundService(Context context) {
|
||||
|
||||
Reference in New Issue
Block a user