https://kotlinlang.org logo
Title
b

brabo-hi

02/09/2022, 6:07 PM
Hi all, from the doc WorkManager invokes ListenableWorker.onStopped() as soon as your Worker has been stopped. Override this method to close any resources you may be holding onto. How could we override
onStopped
since on
CoroutineWorker
it is defined
public final override fun onStopped() {}
l

louiscad

02/09/2022, 6:11 PM
You don't need to, you just want to use `try`/`finally` and put your tear down code in the
finally
block. It's possible you don't even need that because the suspending functions you're using are already handling cancellation properly (with or without a try/finally block).
👍 1