如何获取实例已从通知

时间:2015-10-09 09:13:29

标签: android

我要求获取仍在通知中的misscalls计数以及未与之互动的未读未接来电数量;但刚从通知中删除。我使用了以下查询。但是两者都返回了相同的结果,而在通知中错过了呼叫,并且也从通知中删除了。

String newWhere = CallLog.Calls.TYPE + "=" +
CallLog.Calls.MISSED_TYPE + " AND " + CallLog.Calls.NEW + "=1";

String[] newProjection = {CallLog.Calls.CACHED_NAME,
CallLog.Calls.CACHED_NUMBER_LABEL, CallLog.Calls.TYPE};

Cursor newCursor =
this.getContentResolver().query(CallLog.Calls.CONTENT_URI,
newProjection, newWhere, null, null);

mNewMissedCallCount = newCursor.getCount();

newCursor.close();

String unreadWhere = CallLog.Calls.TYPE + "=" +   CallLog.Calls.MISSED_TYPE    + " AND " +    CallLog.Calls.IS_READ + "=0"; 

String[] unreadProjection =  {CallLog.Calls.CACHED_NAME,   CallLog.Calls.CACHED_NUMBER_LABEL, CallLog.Calls.TYPE};

Cursor unreadCursor = this.getContentResolver()query(CallLog.Calls.CONTENT_URI,
unreadProjection, unreadWhere, null, null); 

mUnreadMissedCallCount = unreadCursor.getCount();

unreadCursor.close();

请建议我 如何获取已从通知

中删除的未读未接来电计数

1 个答案:

答案 0 :(得分:0)

您只需检查 未读 消息情况,

 String where = CallLog.Calls.IS_READ+"=0";