I am trying to find the number of unread SMS messages I have received via Google Hangouts.I tried this answer (Using new Telephony content provider to read SMS), and modified the code to count unread messages. It returns 0 every time. If I try to get the read count, by switching "read = 0"
to "read = 1"
, the count is still 0.
I realize this means I have an empty SMS inbox in Hangouts, but in reality I do not. Any ideas on what I might be doing wrong?
When I switch my default SMS app to Messenger, it gets the unread count without a problem.
Finally, this is the code I'm using:
private int getUnreadMessageCount() {
Cursor c = getContentResolver().query(Telephony.Sms.Inbox.CONTENT_URI, null, "read = 0", null, null);
int unreadCount = c.getCount();
c.close();
return unreadCount;
}
Any help is truly appreciated. Thank you!