xxfast
10/21/2021, 12:12 AMWorkManager
’s `CoroutineWorker`s, is there a way to run clean up work during onStopped()
? looks like this is marked as final
in the implementation for some reasonephemient
10/21/2021, 12:21 AMoverride suspend fun doWork(): Result = try {
...
} catch (e: CancellationException) {
// run on cancellation (note: cannot suspend here)
throw e
}
should be executed when that happensIan Lake
10/21/2021, 12:50 AMIan Lake
10/21/2021, 12:51 AMfinally
block seems like the appropriate place for unconditional clean up workephemient
10/21/2021, 1:03 AMfinally
is almost always what you want to handle instead of CancellationException
, yesClament John
10/21/2021, 6:22 AMfinally
block