https://kotlinlang.org logo
g

Giuliopime

07/11/2023, 5:01 AM
What would be the kotlin way of planning a task at X minutes from now? Is there some premade class for this?
j

Jeff Lockhart

07/11/2023, 6:56 AM
Copy code
scope.launch {
    delay(x.minutes)
    doSomething()
}
Of course this doesn't account for platform restrictions on background work if your app isn't in the foreground and could be killed. That has to be handled in a platform-specific way.