Android查找未读短信和彩信

private static final String UNREAD_SELECTION = "(read=0 OR seen=0)";
//get sms unread count
Cursor cursor = resolver.query(Sms.Inbox.CONTENT_URI,
                null,
                UNREAD_SELECTION,
                null,
                null);

int sms_unread_count = cursor.getCount();

//get mms unread count
Cursor cursor = resolver.query(Mms.Inbox.CONTENT_URI,
                null,
                UNREAD_SELECTION,
                null,
                null);
int mms_unread_count = cursor.getCount();

return (sms_unread_count + mms_unread_count);

你可能感兴趣的:(android)