I'm learning android programming and to practice I want to develop a little app. The idea is to count the sent messages, like a counter...
The approach I was thinking of was doing a service that monitors the "content://sms/out" I do this by using a ContentObserver, inside the onChange method I increment some kind of counter or something like that... then from an activity I fetch the data from service (IPC)...
Is this a good way of doing this? I've been reading a lot and I couldn't make out a best way of writing this little test app...
There is no "global variable" or something like that where android stores the amount of sent messages right?? Because I couldn't find that...
Thanks for reading!!
===================================UPDATE======================================== I've been doing some research and found there are two kind of applications in the market that count the sent sms.
- The first group, just read the amount of sms in the cellphone. I did the following test, I checked how many sms this app showed me, after that I deleted a message and the app showed one message less. This is not a good approach. The app that behave in this wave is this one https://market.android.com/details?id=org.kknd.android.smscounter&feature=search_result#?t=W251bGwsMSwxLDEsIm9yZy5ra25kLmFuZHJvaWQuc21zY291bnRlciJd
- The second group I don't know how, counts perfectly the messages sent, I did the same test I did in the previos case and the app showed the correct number of sent and received messages... So I thought that the app must have some kind of service running all the time to check the messages... But for my surprise there is no service, so how this app work?!?!?!? The app is: https://market.android.com/details?id=nitro.phonestats&feature=search_result#?t=W251bGwsMSwxLDEsIm5pdHJvLnBob25lc3RhdHMiXQ.. (great app by the way...)
Any idea???