SrSouza
10/12/2019, 2:04 PMdelay
?
I want to know because when a launch a new job in Dispatchers.Main and use Thread.sleep, the codes blocks, and its okay, this make sense, but, how delay
doesn't block when I use it in the Dispatchers.Main? He create a new single thread pool and waits three and use suspendCoroutine and resume after that?Dominaezzz
10/12/2019, 2:15 PMDispatchers.Main
has support for delays without having to create a new thread pool. It basically depends on where you use delay
.Handler.postDelayed
is used.SrSouza
10/12/2019, 2:24 PMDominaezzz
10/12/2019, 2:44 PMlouiscad
10/12/2019, 4:50 PMAlarmManager
depending on your use caseAdam Powell
10/12/2019, 8:34 PMWorkManager
. There are startlingly few reasons for using AlarmManager
in 2019.louiscad
10/13/2019, 2:52 AMAdam Powell
10/13/2019, 3:08 AMSrSouza
10/26/2019, 1:26 PMsuspendCoroutine
that's delay using AlarmManager: https://github.com/DevSrSouza/coroutines-alarm-delay#coroutines-alarm-delaylouiscad
10/26/2019, 6:20 PMsuspendCancellableCoroutine
and cancel the pending intent in the finally block.