Success
:val work = PeriodicWorkRequestBuilder<UpdateWorker>(1, TimeUnit.DAYS)
.setConstraints(constraints) // Internet connection, idle and battery not low
.addTag("ANNOUNCEMENTS_WORKER_TAG")
.build()
val workOperation = workManager.enqueueUniquePeriodicWork("UPDATE_WORK_TAG", ExistingPeriodicWorkPolicy.KEEP, work)
workOperation.state.observe(this, Observer { state ->
Timber.d("state: $state") // is successful
})
我现在怎么知道这真的在发生?我如何(单元)测试我的任务的重复执行?