<@UCENTBEN9> &gt; threads to manage networking I’m...
# android
g
@CamilleBC
threads to manage networking
I’m not sure that understand you question, but try to give few points Use raw threads for Android app is pretty error-prone (you should support lifecycle) thing, but coroutines also use threads under the hood, it’s just an abstraction not a completely separate replacement for threads (but replacement for some use cases when you could use threads) Actual blocking/non-blocking implementation of Networking depends on implementation, so not sure how this related to android or viewmodel Coroutines is abstraction for callbacks and kotlinx.coroutines also provides facilities (Coroutine Dispatcher) to dispatch coroutines on particular threads But again, I still don’t understand your question completely. Do you choose between coroutines and what?
Is it possible for example to use a ViewModel to manage the data for the views, and when an event happens in the UI, have the data update using asynchronous calls to the API?
Yes, of course. Check kotlinx.coroutines guide to UI programming: https://github.com/Kotlin/kotlinx.coroutines/blob/master/ui/coroutines-guide-ui.md