Use this code

public static int getUnreadSmsCount(Context context) {
         String SMS_READ_COLUMN = "read";
         String UNREAD_CONDITION = SMS_READ_COLUMN + "=0";
         int count = 0;

         Cursor cursor = context.getContentResolver().query(
               SMS_INBOX_CONTENT_URI,
               new String[] { SMS_ID },
               UNREAD_CONDITION, null, null);

         if (cursor != null) {
            try {
               count = cursor.getCount();
            } finally {
               cursor.close();
            }
         }

         // We ignored the latest incoming message so add one to the
total count

         //   count += 1;



         return count;
   }

On Jul 14, 9:49 pm, n179911 <[email protected]> wrote:
> Hi,
>
> Can you please tell me how can i query the number ofunreadSMSin
> android programmically?
>
> i.e. How can I implement theSMSunreadcount like this 
> link:http://android.kanokgems.com/sms-unread-count/
>
> Thank you.

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to