Use the choosen interval as the worker initial delay

This commit is contained in:
Shinokuni 2020-07-11 15:49:42 +02:00
parent e39c16d635
commit a8764e91f5
1 changed files with 1 additions and 1 deletions

View File

@ -77,7 +77,7 @@ public class SettingsFragment extends PreferenceFragmentCompat {
PeriodicWorkRequest request = new PeriodicWorkRequest.Builder(SyncWorker.class, interval.first, interval.second) PeriodicWorkRequest request = new PeriodicWorkRequest.Builder(SyncWorker.class, interval.first, interval.second)
.addTag(SyncWorker.Companion.getTAG()) .addTag(SyncWorker.Companion.getTAG())
.setConstraints(constraints) .setConstraints(constraints)
.setInitialDelay(15, TimeUnit.MINUTES) .setInitialDelay(interval.first, interval.second)
.build(); .build();
workManager.enqueueUniquePeriodicWork(SyncWorker.Companion.getTAG(), ExistingPeriodicWorkPolicy.REPLACE, request); workManager.enqueueUniquePeriodicWork(SyncWorker.Companion.getTAG(), ExistingPeriodicWorkPolicy.REPLACE, request);