Get the amount of sent sms
<p>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... </p>

<p>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)...</p>

<p>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... </p>

<p>There is no "global variable" or something like that where android stores the amount of sent messages right?? Because I couldn't find that...</p>

<p>Thanks for reading!!</p>

<p>===================================UPDATE========================================
I've been doing some research and found there are two kind of applications in the market that count the sent sms.</p>

<ol>
<li>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 <a href="https://market.android.com/details?id=org.kknd.android.smscounter&amp;feature=search_result#?t=W251bGwsMSwxLDEsIm9yZy5ra25kLmFuZHJvaWQuc21zY291bnRlciJd" rel="nofollow">https://market.android.com/details?id=org.kknd.android.smscounter&amp;feature=search_result#?t=W251bGwsMSwxLDEsIm9yZy5ra25kLmFuZHJvaWQuc21zY291bnRlciJd</a></li>
<li>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: <a href="https://market.android.com/details?id=nitro.phonestats&amp;feature=search_result#?t=W251bGwsMSwxLDEsIm5pdHJvLnBob25lc3RhdHMiXQ" rel="nofollow">https://market.android.com/details?id=nitro.phonestats&amp;feature=search_result#?t=W251bGwsMSwxLDEsIm5pdHJvLnBob25lc3RhdHMiXQ</a>.. (great app by the way...)</li>
</ol>

<p>Any idea???</p>
