coroutines-android question: <https://kotlinlang.s...
# coroutines
g
a
Depends on the scope the coroutine is laughed in, it may finish the execution of may be cancelled if the scope tied to the fragment lifecycle. Read the docs on the coroutine scopes to better understand.
g
Thanks, @Anastasia Finogenova. Makes sense. Did go through the docs again to see what I was missing
l
If you want to request runtime permissions, you might want to use #splitties permissions, where most of the work has been done for you.
g
Thanks, I didn’t know splitties. Will take a look at it. I wish to know if there’s any problems with my approach though, to see if I’m getting scopes right…
l
Well, I think you should not rely on a Fragment being nested for that use case. Splitties permissions are agnostic to that, plus handle a bug in the framework where you can get your Activity in a state where it can no longer request permissions. All you need is to use the lifecycleScope of viewLifecycleOwner in a Fragment or lifecycleScope in an Activity to run the coroutine where you request the permission.