Added force sync

This commit is contained in:
M66B
2019-08-12 17:02:34 +02:00
parent eacb162de4
commit fe7887a114
6 changed files with 36 additions and 10 deletions

View File

@@ -1554,6 +1554,13 @@ public class ServiceSynchronize extends ServiceBase {
}
static void reset(Context context) {
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context);
boolean enabled = prefs.getBoolean("enabled", true);
int pollInterval = prefs.getInt("poll_interval", 0);
if (!enabled || pollInterval > 0) {
ServiceSynchronize.sync = true;
oneshot = true;
}
ContextCompat.startForegroundService(context,
new Intent(context, ServiceSynchronize.class)
.setAction("reset"));