【问题标题】:How to get the count of unread missed call whose instance has removed from notification如何获取实例已从通知中删除的未读未接来电计数
【发布时间】:2017-01-29 16:11:32
【问题描述】:

我需要获取仍在通知中的未接来电计数和我未交互的未读未接来电计数;但刚刚从通知中删除。我使用了以下查询。但是两者都返回相同的结果,而在通知中未接来电并且也从通知中删除。

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();

请给我建议 如何获取已从通知中删除的未读未接来电计数

【问题讨论】:

    标签: android


    【解决方案1】:

    您只需要检查未读消息条件,

    也就是说,

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

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多