Method doWork() not calling with WorkManager
Solved
The trick was in that we have to create out task by this way:
UploadFileTask(context: Context, workerParams: WorkerParameters) : Worker(context, workerParams)
The constructor of our task have to receive exactly two parameters: context: Context
and workerParams: WorkerParameters
Explanation:
val downloadWork = OneTimeWorkRequest.Builder(downloadingTask)
.addTag(ID_TAG)
.keepResultsForAtLeast(0, TimeUnit.SECONDS)
.build()
workManager.enqueue(downloadWork)
WorkManager
expects to receive downloadWork
which was biult with downloadingTask
, that has exactly two params in its constructor