https://kotlinlang.org logo
#android
Title
# android
f

Florian

02/13/2021, 2:47 PM
Are there situations when
viewLifecycleOwner.lifecycleScope.launch
(instead of
launchWhenStarted
) would crash if it collected a value while the app is in the background?
i

Ian Lake

02/13/2021, 7:24 PM
Sure, if you do a FragmentTransaction in response to that value changing, that is only guaranteed to be safe if you're started, hence
launchWhenStarted
would never crash, but
launch
certainly could
👍 1
f

Florian

02/13/2021, 7:52 PM
Thank you!
7 Views