dave08
11/24/2019, 5:23 PMrunBlocking {}
isn't possible anymore, since you can't use the lifecycleScope
with it...louiscad
11/25/2019, 1:20 PMrunBlocking
on Android for something other than tests is almost always a bad idea.dave08
11/25/2019, 1:35 PMoverride fun onPerformSync(
account: Account,
bundle: Bundle,
s: String,
contentProviderClient: ContentProviderClient,
syncResult: SyncResult
) = coroutineScope.launch {
syncEventTrigger.onSyncStart(context, syncResult)
.onStart { i { "Sync Started" } }
.onCompletion { i { "Sync Stopped" } }
.collect()
}.let { Unit }
collect
finishes...lifecycleScope
is using Dispatchers.Main.immediate
, that it will block the service until the sync is finished. Am I right?runBlocking
might be better here...louiscad
11/25/2019, 3:50 PMdave08
11/25/2019, 3:52 PMlouiscad
11/25/2019, 7:18 PMLifecycleService
from your IDE to find out, and be sure.