Are there any best practices for using/calling coroutines from an Android ContentProvider? I’m thinking in terms of CoroutineScopes and contentprovider lifecycle, etc.
l
louiscad
05/03/2020, 10:03 AM
runBlocking. The scope of a ContentProvider is either a call to one of its function, or the app process depending on what you want to do.
m
Mark
05/03/2020, 10:10 AM
Ok thanks Louis. How about the shutdown() implementation. Anything to think about there?
method is only ever called in unit testing. If you're unit testing your
ContentProvider
and use something other than
runBlocking
, you can cancel your custom
CoroutineScope
in this callback.
👍 1
m
Mark
05/05/2020, 3:15 AM
How about the CancellationSignal? Instead of passing that through the suspend functions (and checking it in loops, for example), is there a better way?