Select correct demonstration of WorkRequest cancellation.
Select correct demonstration of WorkRequest cancellation.
A . workManager.enqueue(OneTimeWorkRequest.Builder(FooWorker::class.java).build())
B . val request: WorkRequest = OneTimeWorkRequest.Builder (FooWorker::class.java).build() workManager.enqueue(request)
val status = workManager.getWorkInfoByIdLiveData(request.id) status.observe(…)
C . val request: WorkRequest = OneTimeWorkRequest.Builder (FooWorker::class.java).build() workManager.enqueue(request) workManager.cancelWorkById(request.id)
D . val request1: WorkRequest = OneTimeWorkRequest.Builder (FooWorker::class.java).build()
val request2: WorkRequest = OneTimeWorkRequest.Builder (BarWorker::class.java).build()
val request3: WorkRequest = OneTimeWorkRequest.Builder (BazWorker::class.java).build()
workManager.beginWith(request1, request2).then(request3).enqueue()
E . val request: WorkRequest = OneTimeWorkRequest.Builder (FooWorker::class.java).build()
workManager.enqueue(request) workManager.cancelWork(request)
Answer: C
Explanation:
Videos:
Working with WorkManager, from the 2018 Android Dev Summit WorkManager: Beyond the basics, from the 2019 Android Dev Summit
Reference: https://developer.android.com/reference/androidx/work/WorkManager?hl=en
Latest Associate Android Developer Dumps Valid Version with 107 Q&As
Latest And Valid Q&A | Instant Download | Once Fail, Full Refund