androidcalllog

How to remove call logs from android programmatically?


how to delete/remove call log from application. I am doing like this

 this.getContentResolver().delete(CallLog.Calls.CONTENT_URI,null,null);

it not working.


Solution

  • Make sure u have following permissions in Manifest.xml:

    <uses-permission android:name="android.permission.READ_CONTACTS" /> 
    <uses-permission android:name="android.permission.WRITE_CONTACTS" />
    

    For deleting call logs for particular number try this way:

    public void DeleteCallLogByNumber(String number) {   
        String queryString = "NUMBER=" + number; 
        this.getContentResolver().delete(CallLog.Calls.CONTENT_URI, queryString, null);  
    }