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

2025年01月07日 07:11
有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 论坛。。有教程的