WorkManager beginUniqueWork doesn't work as expected

前端 未结 2 1560
爱一瞬间的悲伤
爱一瞬间的悲伤 2021-02-14 17:44

Currently, I\'m using WorkManager 1.0.0-alpha02.

def work_version = \"1.0.0-alpha02\"
implementation \"android.arch.work:work-runtime:$work_version\" // use -ktx         


        
2条回答
  •  独厮守ぢ
    2021-02-14 18:38

    beginUniqueWork() returns a WorkContinuation object. You need to call enqueue on that WorkContinuation to actually enqueue it with WorkManager:

    workManager.beginUniqueWork(
        SyncWorker.TAG,
        ExistingWorkPolicy.REPLACE,
        oneTimeWorkRequest
    ).enqueue();
    

提交回复
热议问题