Let watchdog reschedule missed alarms

This commit is contained in:
M66B
2020-03-25 10:44:50 +01:00
parent 3f7187a769
commit 4387237a6f
2 changed files with 16 additions and 1 deletions

View File

@@ -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"));
}
}