I’m just now using coroutines in Android more excl...
# android
b
I’m just now using coroutines in Android more exclusively. I build a library that takes care of analytics for a suite of apps. The public functions on that library are
suspend
functions. If I want to log, say, which screen the user opened then I’ll want to call one of those
suspend
functions from the library. However, if I’m calling from
onCreate
in an
Activity
, what coroutine scope do I want to use? I want the analytics to get recorded and not canceled if the
Activity
is destroyed.
n
I think the best approach is to use the
ProcessLifecycleOwner
as the coroutine scope.
👍🏽 1