I am developing an app to show the user the "number of messages sent" so that they can manage their free quota without over running it. I did some research and with that I am able to register a ContentObserver from a Service to Observe the sms URI. It would be helpful if some one could give me the following information:
- Is it ok to start this service on BOOT_COMPLETE
- Should I
unregister
the contentObserver at some point, if so when? - Should I run the 'registerContentObserver' on a new Thread?
Note: Inside my Observer, for a Sent SMS, I will just update a value in an MySQL Database.
I have implemented my requirement with research and help from the G+ Android Developer community. You can see the implementation at the below links from GitHub.
And based on my experiences, I am giving the answers as below.
https://github.com/midhunhk/message-counter/tree/master/v2/MessageCounter/src/com/ae/apps/messagecounter/observers https://github.com/midhunhk/message-counter/tree/master/v2/MessageCounter/src/com/ae/apps/messagecounter/services