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
CoroutineWorkerto get the idWorkRequestthat created it . It comes fromListenableWorkerso you should be able to call it .