How to clear call log history in Android?

How can you clear the entire call log history in android? I currently have this code that can only clear a specific call log

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

I was able to do this with this, but it was a while. Not sure if this still works.

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

EDIT: Please note: I’m not sure that application platform developers can delete the call log . See this blog post on the blog , So while this works technically, please consider this a fair warning that it may any moment to change and break what you are trying to build.

+7
source

API.

, , ( ), . Cursor. : 60 , Cursor, .

: API 11+ CursorLoader managedQuery(...).

+2

Try the following:

String queryString="DURATION >= 0"; 
this.getContentResolver().delete(android.provider.CallLog.Calls.CONTENT_URI, queryString, null);
+1
source

All Articles