I have my question in the following link SmS count not increasing. message id is constant any one please answer. thanks for help.
Asked
Active
Viewed 188 times
-1
-
possible duplicate of [SmS count not increasing. message id is constant](http://stackoverflow.com/questions/10202850/sms-count-not-increasing-message-id-is-constant) – Mitch Wheat Apr 19 '12 at 04:55
-
@MitchWheat duplicate but that answer is unanswered. – Lalit Poptani Apr 19 '12 at 05:07
-
@Me and We: that's not how this site works.... – Mitch Wheat Apr 19 '12 at 05:20
2 Answers
2
Uri sms_content = Uri.parse("content://sms");
Cursor c = this.getContentResolver().query(sms_content, null,null, null, null);
And now you can work with Cursor c
. like c.getCount()
for total Sms
There are more options like content://sms/sent
or content://sms/inbox
.
And don't forget to Give Permission.
<uses-permission android:name="android.permission.READ_SMS"></uses-permission>

Bhavin
- 6,020
- 4
- 24
- 26
1
If you are interested to track only incoming SMS it would be better to use a Broadcast with action android.provider.Telephony.SMS_RECEIVED
that will track it better than ContentObserver
. Try this one.

Community
- 1
- 1

Lalit Poptani
- 67,150
- 23
- 161
- 242