'How to get the remaining time after which worker will do work?

I schedule one time work in 100 minutes:

val request = OneTimeWorkRequestBuilder<MyWorker().setInitialDelay(100, TimeUnit.MINUTES).build()
WorkManager.getInstance(context).enqueueUniqueWork(
    "MY_WORKER_NAME",
    ExistingWorkPolicy.REPLACE,
    request
)

class MyWorker(context: Context, workerParameters: WorkerParameters) : CoroutineWorker(
    context, workerParameters) {
    override suspend fun doWork(): Result {
       return Result.success()
}

How can I get the remaining time, before doWork() is executed? For example, I need to know it immediately after I reboot my Android device



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source