android怎么样才可以获得未读短信条数?具体一点,权限也要说一下,谢谢!!

2025-01-07 07:11:25
推荐回答(2个)
回答1:

//get sms unread count
Cursor cursor = resolver.query(Sms.Inbox.CONTENT_URI,
UNREAD_PROJECTION,
UNREAD_SELECTION,
null,
null);

int sms_unread_count = cursor.getCount();

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

return (sms_unread_count + mms_unread_count);

回答2:

上android 论坛。。有教程的