Update WorkManager (#8772)

This commit is contained in:
Ivan Iskandar
2022-12-19 00:14:06 +07:00
committed by GitHub
parent 46417fe427
commit 8552838bda
6 changed files with 20 additions and 7 deletions
@@ -59,7 +59,9 @@ class LibraryUpdateJob(private val context: Context, workerParams: WorkerParamet
.setConstraints(constraints)
.build()
WorkManager.getInstance(context).enqueueUniquePeriodicWork(TAG, ExistingPeriodicWorkPolicy.REPLACE, request)
// Re-enqueue work because of common support suggestion to change
// the settings on the desired time to schedule it at that time
WorkManager.getInstance(context).enqueueUniquePeriodicWork(TAG, ExistingPeriodicWorkPolicy.CANCEL_AND_REENQUEUE, request)
} else {
WorkManager.getInstance(context).cancelAllWorkByTag(TAG)
}