gildor
09/24/2018, 2:44 PMaaverin
09/25/2018, 9:44 AMdoStuff() is private
Would you recommend to move to another class and have just a manager kind of class that will run coroutine in proper dispatcher and do nothing else?gildor
09/25/2018, 9:45 AMaaverin
09/25/2018, 9:45 AMaaverin
09/25/2018, 9:46 AMjob and handle cancelation if necessary, thus it’s not exposed as suspendgildor
09/25/2018, 9:47 AMgildor
09/25/2018, 9:47 AMmyMethod that you do not return Jobgildor
09/25/2018, 9:47 AMgildor
09/25/2018, 9:47 AMgildor
09/25/2018, 9:48 AMgildor
09/25/2018, 9:49 AMdoStuff than just GlobalScope.launch and a function that runs and forgetgildor
09/25/2018, 9:52 AMgildor
09/25/2018, 9:53 AMgildor
09/25/2018, 9:59 AMWould you recommend to move to another class and have just aActually, this is one of possible solutions, but even in this case probably it can be somehow improvedkind of class that will run coroutine in proper dispatcher and do nothing elsemanager
aaverin
09/25/2018, 10:18 AMsuspend then, essentially, only Activity/Fragment would be using dispatchers and would be running coroutines?aaverin
09/25/2018, 10:19 AMaaverin
09/25/2018, 10:19 AMaaverin
09/25/2018, 10:20 AMmanager classaaverin
09/25/2018, 10:23 AMwithContext for services, that have to definitely run in background, like, 3rd party API callsaaverin
09/25/2018, 10:23 AMgildor
09/26/2018, 1:05 AMgildor
09/26/2018, 1:05 AMaaverin
09/26/2018, 7:59 AMsubscribeOn and observeOn, and once you get the description of those methods – it’s quite easy to see which thread code will be called on, and which thread will subscriber receive the data on.
With coroutines it’s not that easy somehow.gildor
09/26/2018, 8:21 AM