Is there a way to retrieve the android Handler fro...
# coroutines
d
Is there a way to retrieve the android Handler from coroutineContext?
g
You can get dispatcher but there is no public method to get handler from dispatcher
coroutineContext[Dispatcher]
d
Oh... I'm trying to adapt a library's callbacks to coroutines, and I need to pass it a handler in
suspendCoroutine { }
so that it can run on it... 😕
g
I’m not sure about your case. Can you give little bit more context
Just create a handler or pass it to await function, why do you need Handler from coroutineContext? Because coroutineContext may have no any dispatcher or no HandlerDispatcher
d
I need to run a library on my android service's Handler, but it would be a plus if I could have it run on the caller CoroutineScope's dispatcher handler?
g
But what if caller doesn't use dispatcher with handler
Why not just let user of API pass handler if it's important