I'm using Room on Android and I've replaced AsyncT...
# getting-started
j
I'm using Room on Android and I've replaced AsyncTask with coroutines. It seems to work but I'm wondering if there is a better way than
GlobalScope.launch { dao.insert(note) }
for simple background work where I don't expect a result. Also, would
thread { dao.insert(note) }
be an appropriate alternative?
e
MInd the resources if you launch too many async tasks (network is slow, but user clicks fast).
thread
would eat your memory very fast, coroutines are much cheaper, but you might still consider limiting concurrency
j
Thanks!