tags:

views:

39

answers:

1

How can I get the number of unread sms in android?

+1  A: 

Need execute simple query to SMS ContentProvider. Here working example:

final Uri SMS_INBOX = Uri.parse("content://sms/inbox");

Cursor c = getContentResolver().query(SMS_INBOX, null, "read = 0", null, null);
int unreadMessagesCount = c.getCount();
c.deactivate();
Sergey Glotov