How can I update the contents of an entry in the Call Log?

后端 未结 3 1455
情话喂你
情话喂你 2020-12-15 14:50

I would like to update the CallLog.Calls.TYPE field of the first entry in the Android Call Log from MISSED to INCOMING. I have read b

3条回答
  •  心在旅途
    2020-12-15 15:23

    for example CallLog.Calls.CACHED_NAME

    private void updateCachedName(int id, @NonNull String name) {
    
        ContentValues contentValues = new ContentValues();
        contentValues.put(CallLog.Calls.CACHED_NAME, name);
    
        if (ActivityCompat.checkSelfPermission(getActivity(), Manifest.permission.WRITE_CALL_LOG) == PackageManager.PERMISSION_GRANTED) {
    
            getContext().getContentResolver().update(CallLog.Calls.CONTENT_URI, contentValues, CallLog.Calls._ID + "=" + id, null);
        }
    }
    

提交回复
热议问题