Search code examples
androidphone-callcalllog

How do you clear your call logs history in android?


How can you clear the entire call log history in android? Currently i have this code that can only clear a particular call log

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

Solution

  • I was able to do it with this, It's been a while though. Not sure if this still works.

    getContentResolver().delete(android.provider.CallLog.Calls.CONTENT_URI, null, null) ;
    

    EDIT: Please note I am not certain that the platform designers intended for apps to be able to delete the call log See this dev blog post. So while this does technically work please take this as a fair warning that it may at any point change and break what you are trying to build.