如何屏蔽未接来电中的Android阅读?(how to mask missed calls to r

2019-09-03 07:31发布

我的工作在Android应用程序,显示使用未接来电:

String[] projection = new String[]{CallLog.Calls.NUMBER,
                CallLog.Calls.TYPE,
                CallLog.Calls.DURATION,
                CallLog.Calls.CACHED_NAME,
                CallLog.Calls._ID};

        String where = CallLog.Calls.TYPE+"="+CallLog.Calls.MISSED_TYPE+" AND " + CallLog.Calls.NEW + "=1" ;         
        Cursor c = context.getContentResolver().query(CallLog.Calls.CONTENT_URI,projection,where, null, null);
        c.moveToFirst();    
        if(c.getCount() > 0)
        newCountersObj.missedCallCounter=c.getCount();

在我的Android的ListView检查未接来电后,我想将它们标记为android系统DB读取。 我怎样才能做到这一点?

用以下链接问题的更新

明确的未接来电错误android.database.SQLite

Answer 1:

通过设置is_read标志设置为true。 参考: http://developer.android.com/reference/android/provider/CallLog.Calls.html#IS_READ

实施例(来自ClearMissedCallsService ):

    // Clear the list of new missed calls.
    ContentValues values = new ContentValues();
    values.put(Calls.NEW, 0);
    values.put(Calls.IS_READ, 1);
    StringBuilder where = new StringBuilder();
    where.append(Calls.NEW);
    where.append(" = 1 AND ");
    where.append(Calls.TYPE);
    where.append(" = ?");
    context.getContentResolver().update(Calls.CONTENT_URI, values, where.toString(),
            new String[]{ Integer.toString(Calls.MISSED_TYPE) });


文章来源: how to mask missed calls to read in android?