One of Android's APIs is the ability to get the cu...
# coroutines
d
One of Android's APIs is the ability to get the current location. It calls an onSuccess function when it has a location. Presently, I've wrapped this API in a suspending function that waits until it has the location and returns. The problem is I have a service (function) that calls the suspending function which, because it's a normal function has to do a launch. The thread on the service continues onwards whilst the suspending location function can take a while to return. I thought about wrapping the call to the suspending function (itself within a launch) in a runBlocking, but that is no longer viable due to 0.24.0 and also, not practical since I tried with 0.23.4 and what happens is that the location API just hangs with no location onSuccess callback being called since runBlocking (in 0.23.4) hangs the entire thread. So, I'm at a loss. I need to bridge between the non-blocking world of obtaining a location and the blocking world (waiting for the location)...what do?