Can I setInputData([someDataChangeEveryWorkerStart](
val uploadWorkRequest = PeriodicWorkRequestBuilder<UploadWorker>((1, TimeUnit.HOURS))
.setInputData(imageData)
.build()
哪个图像数据每 1 小时更改一次
当你完成方法doWork
时,在你的Worker
里面,你应该enqueueUniquePeriodicWork
新数据并使用ExistingPeriodicWorkPolicy.REPLACE
来替换当前的工作线程
val uploadWorkRequest = PeriodicWorkRequestBuilder<UploadWorker>((1, TimeUnit.HOURS))
.setInputData(newImageData)
.build()
WorkManager.getInstance(applicationContext).enqueueUniquePeriodicWork(
“YourWorkerTag”,
ExistingPeriodicWorkPolicy.REPLACE,
uploadWorkRequest)