Let watchdog reschedule missed alarms

pull/177/head
M66B 5 years ago
parent 3f7187a769
commit 4387237a6f

@ -662,6 +662,10 @@ public class ServiceSynchronize extends ServiceBase implements SharedPreferences
onAlarm(intent);
break;
case "watchdog":
onWatchdog(intent);
break;
default:
Log.w("Unknown action: " + action);
}
@ -713,6 +717,11 @@ public class ServiceSynchronize extends ServiceBase implements SharedPreferences
liveAccountNetworkState.post(command);
}
private void onWatchdog(Intent intent) {
schedule(this);
onEval(intent);
}
private NotificationCompat.Builder getNotificationService(Integer accounts, Integer operations) {
if (accounts != null)
this.lastAccounts = accounts;
@ -1910,4 +1919,10 @@ public class ServiceSynchronize extends ServiceBase implements SharedPreferences
new Intent(context, ServiceSynchronize.class)
.setAction("alarm"));
}
static void watchdog(Context context) {
ContextCompat.startForegroundService(context,
new Intent(context, ServiceSynchronize.class)
.setAction("watchdog"));
}
}

@ -44,7 +44,7 @@ public class WorkerWatchdog extends Worker {
@Override
public Result doWork() {
Log.i("Running " + getName());
ServiceSynchronize.eval(getApplicationContext(), "watchdog");
ServiceSynchronize.watchdog(getApplicationContext());
ServiceSend.watchdog(getApplicationContext());
return Result.success();
}

Loading…
Cancel
Save