I have a situation where I need to send WorkRequest.id
to CoroutineWorker.
I'm dealing with Room DB from CoroutineWorker
, now in one of the Column in DB, I need to store WorkRequest.id (UUID) so that when a user cancels a task from list of task in recyclerview, I can come to know which WorkRequest UUID to cancel.
Now my problem is that WorkRequest's id is created after the data is assigned to setInputData()
, so before the id created, how can I send the WorkRequest.id to my worker.
Is there a way I can send extra data to CoroutineWorker after the WorkRequest is created ?
You can call #getId() in CoroutineWorker
to get the id WorkRequest
that created it . It comes from ListenableWorker
so you should be able to call it .