luke_c
03/24/2020, 10:41 AMprivate val remoteConfigFetch = lifecycleScope.launch { FirebaseRemoteConfig.init() }
Then further on before the splash screen finally moves on I’m calling join
private fun continueToApp() = runBlocking {
remoteConfigFetch.join()
goToMainActivity()
}
Is this the correct approach? Initially I thought about using async but figured because I don’t care about whether it fails or errors and don’t care about the result it was better to use launch?Animesh Sahu
03/24/2020, 12:40 PMrunBlocking
here, from where ever you're calling this that thread would become blocked,
I suggest to use suspend modifier in continueToApp
instead of using runBlocking{}
In launching part everything looks promising, but if your call requires some i/o or networking then be sure to wrap the call under withContext(Dispatchers.IO){"code"} inside launch.luke_c
03/24/2020, 12:53 PMAnimesh Sahu
03/24/2020, 12:56 PMluke_c
03/24/2020, 12:57 PMAnimesh Sahu
03/24/2020, 1:04 PMAnimesh Sahu
03/24/2020, 1:06 PMAnimesh Sahu
03/24/2020, 1:11 PMluke_c
03/24/2020, 1:37 PM