|
|
|
@ -1446,7 +1446,9 @@ public class ServiceSynchronize extends ServiceBase {
|
|
|
|
|
int pollInterval = prefs.getInt("poll_interval", 0);
|
|
|
|
|
int accounts = db.account().getSynchronizingAccounts().size();
|
|
|
|
|
if (enabled && pollInterval == 0 && accounts > 0)
|
|
|
|
|
init(context);
|
|
|
|
|
ContextCompat.startForegroundService(context,
|
|
|
|
|
new Intent(context, ServiceSynchronize.class)
|
|
|
|
|
.setAction("init"));
|
|
|
|
|
else {
|
|
|
|
|
for (EntityAccount account : db.account().getAccounts())
|
|
|
|
|
db.account().setAccountState(account.id, null);
|
|
|
|
@ -1465,12 +1467,6 @@ public class ServiceSynchronize extends ServiceBase {
|
|
|
|
|
thread.start();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void init(Context context) {
|
|
|
|
|
ContextCompat.startForegroundService(context,
|
|
|
|
|
new Intent(context, ServiceSynchronize.class)
|
|
|
|
|
.setAction("init"));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private static void schedule(Context context) {
|
|
|
|
|
Intent alarm = new Intent(context, ServiceSynchronize.class);
|
|
|
|
|
alarm.setAction("alarm");
|
|
|
|
|