如何在我们的应用中实现未读消息通知,如消息(图片中)?
任何帮助表示赞赏
答案 0 :(得分:-2)
public int getNumberOfUnreadMessages(Context context) {
final Uri SMS_INBOX_URI = Uri.parse("content://sms/inbox");
Cursor inboxCursor = context.getContentResolver().query(SMS_INBOX_URI, null, "read =
0", null, null);
int unreadMessagesCount = inboxCursor.getCount();
inboxCursor.close();
return unreadMessagesCount;
}