I need to make a design decision.
From what I read in the android developers site I think I want to implement a Service which launches an AsyncTaskLoader to load data from an OS process in the background.
In the android developers site documentation it says that AsyncTaskLoader can be used in Activities and Fragments, but no mention of Services.
Is it a bad practice to use AsyncTaskLoader in a Service?
If so, how do I collect data from a running OS process in the background? (Note: I need the collection to go on even if the app is closed/destroyed)
Loaders are really for Activities and Fragments, it might make sense to consider an IntentService
if you just want a good way to do some work in background threads. Is there something specific that looked useful in AsyncTaskLoader
?
Either way you won't be able to keep collecting if your app is destroyed. If your app is destroyed, it's not there to do any work. A Service
of some sort is definitely what you want to use to do work in the background though.