Content watcher is running in the background

I was wondering if I encoded a content observer in an Activity, it would work in the background, even if an activity would not be created or started. Do I have to encode it in the service so that it runs in the background?

+3
source share
1 answer
  • Short answer: No, it will not start if yours is Activitynot created. If you want your activity to be notified through the Observer template, you can use subscription at onResume, onCreateand unsubscribe at onPauseor onDestroy. My choice would be to use onResumeand onPause. Thus, yours Activitywill not be notified if it is not visible. You can check Activitylifecycles here .
  • If you want the content observer to run in the background, you must implement your own Service . More about services .
+1
source

All Articles