Handling file download with gRPC on Android
问题 I currently have a gRPC server which is sending chunks of a video file. My android application written in Kotlin uses coroutines for UI updates (on Dispatchers.MAIN) and for handling a unidirectional stream of chunks (on Dispatchers.IO). Like the following: GlobalScope.launch(Dispatchers.Main) { viewModel.downloadUpdated().accept(DOWNLOAD_STATE.DOWNLOADING) // MAKE PROGRESS BAR VISIBLE GlobalScope.launch(Dispatchers.IO) { stub.downloadVideo(request).forEach { file.appendBytes( it.data