ExistingPeriodicWorkPolicy.UPDATE

This commit is contained in:
Milos Kozak 2023-07-15 13:20:55 +02:00
parent 36f15102fe
commit e9971b5ec9
2 changed files with 2 additions and 2 deletions

View file

@ -136,7 +136,7 @@ class MainApp : DaggerApplication() {
) )
WorkManager.getInstance(this).enqueueUniquePeriodicWork( WorkManager.getInstance(this).enqueueUniquePeriodicWork(
KeepAliveWorker.KA_0, KeepAliveWorker.KA_0,
ExistingPeriodicWorkPolicy.REPLACE, ExistingPeriodicWorkPolicy.UPDATE,
PeriodicWorkRequest.Builder(KeepAliveWorker::class.java, 15, TimeUnit.MINUTES) PeriodicWorkRequest.Builder(KeepAliveWorker::class.java, 15, TimeUnit.MINUTES)
.setInputData(Data.Builder().putString("schedule", KeepAliveWorker.KA_0).build()) .setInputData(Data.Builder().putString("schedule", KeepAliveWorker.KA_0).build())
.setInitialDelay(5, TimeUnit.SECONDS) .setInitialDelay(5, TimeUnit.SECONDS)

View file

@ -563,7 +563,7 @@ class OpenHumansUploaderPlugin @Inject internal constructor(
.setBackoffCriteria(BackoffPolicy.LINEAR, 20, TimeUnit.MINUTES) .setBackoffCriteria(BackoffPolicy.LINEAR, 20, TimeUnit.MINUTES)
.setInitialDelay(if (delay) 1 else 0, TimeUnit.DAYS) .setInitialDelay(if (delay) 1 else 0, TimeUnit.DAYS)
.build() .build()
WorkManager.getInstance(context).enqueueUniquePeriodicWork(WORK_NAME_PERIODIC, if (replace) ExistingPeriodicWorkPolicy.REPLACE else ExistingPeriodicWorkPolicy.KEEP, workRequest) WorkManager.getInstance(context).enqueueUniquePeriodicWork(WORK_NAME_PERIODIC, if (replace) ExistingPeriodicWorkPolicy.UPDATE else ExistingPeriodicWorkPolicy.KEEP, workRequest)
} }
internal fun uploadNow() { internal fun uploadNow() {