Android Persistent ContentObserver

Are content watchers persistent on Android? If I create a content watcher in an activity, will that watcher keep running until I remove the watcher.

Basically I am creating a service for SMS where when I send and receive I post an SMS to a web service so I can check my messages without my phone.

If the content observer is bound to an Activity resource, how can I create a ContentObserver that will always receive content notifications: / sms /

+2


a source to share


1 answer


If I create a content watcher in an activity, will the watcher continue to run until I remove the watcher.

Only if you like the memory leak and then only until Android completes the process. A well-done activity will not register content watchers without registering them at the appropriate time (for example onDestroy()

).

how to create ContentObserver that will always receive content notifications: / sms /

The SMS content provider is not part of the SDK. It may or may not work on your phone. It may or may not work in future versions of Android.



The only way to have ContentObserver

that is a little obsessed with being in Service

. However, services

Unfortunately!

+5


a source







All Articles