Skip to main content

How to Check Unread Message in Android

You can check the number of unread SMS in android  in Android. You should use "content://sms/inbox".


Example Code:

public void SmsControl(){
             Uri sms_content = Uri.parse("content://sms/inbox");
             String where = "read = 0";
             Cursor c = context.getContentResolver().query(sms_content, null,where, null, null);
             c.moveToFirst();
             int Value = c.getCount();
             c.deactivate();
       }

I hope this code helps you. You can use "content://sms" or "content://sms/sent" for your needs.   
If you use "null" instead of "where" for every messages in phone.

If you find my blog or apps useful, please consider donating. 


 

Comments

  1. Sevgili arkadasim blog un cokk guzel takip de ediyorum. Yalniz ingilizcen cok kotu be.

    ReplyDelete

Post a Comment