【发布时间】:2016-09-23 11:57:56
【问题描述】:
我在启动应用程序后使用以下代码清除未接来电。在这我得到的行是 1。但是当我收到下一个未接电话时,当时 android 的股票电话应用程序会添加一个新通知作为“2 个新的未接电话”。意思是他们不计较我清楚。我是不是错过了什么。
注意:如果我启动股票电话应用程序一次,计数器将再次重置为 0。
public boolean markMissedCallsAsRead() {
ContentValues values = new ContentValues();
values.put(CallLog.Calls.NEW, Integer.valueOf(0));
values.put(CallLog.Calls.IS_READ, Integer.valueOf(1));
StringBuilder where = new StringBuilder();
where.append(CallLog.Calls.NEW);
where.append(" = 1 AND ");
//where.append(CallLog.Calls.IS_READ).append(" = 0");
//where.append(" AND ");
where.append(CallLog.Calls.TYPE).append(" = ").append(CallLog.Calls.MISSED_TYPE);
int rows = context.getContentResolver().update(CallLog.Calls.CONTENT_URI, values, where.toString(),
null);
Utilities.writeToLogFile(Constants.LOG_ERROR_LEVEL, "cleared call logs " + rows);
return true;
}
【问题讨论】:
标签: android call android-5.0-lollipop android-6.0-marshmallow android-5.1.1-lollipop