2013-01-15 54 views
2

How to implement unread message notification in our app like in messaging?顯示未讀郵件數的Android

如何實現短信未讀消息通知在我們的應用程序等(圖)?

任何幫助讚賞

+0

複製http://stackoverflow.com/questions/11665237/how-to-show-notification-count-on-my-app-icon-on-home-screen- in-android – eestein

+1

但沒有得到正確答案。 –

+1

這個答案是正確的答案。你不應該在android上這樣做。 – eestein

回答

-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; 
    } 
+0

確實嘗試回答正確的事情...嘗試瞭解用戶要求的內容..... @ Gaurav Jain –