Wednesday, December 14, 2011

delete all call history by a particular number in android phone

AIM:
To delete all call history associated with a particular number from the original call history of android phone.
Solution:
By executing the below lines will delete  all call history by a particular number will gets erased permenently.


        String strUriCalls = "content://call_log/calls"; // URI for CallLog in 2.2 and above
        Uri UriCalls = Uri.parse(strUriCalls);
        String queryString = "NUMBER='" + number + "'";
        Log.v("Number", queryString);
        int noofDeletedRows = getContentResolver().delete(UriCalls, queryString, null);
        Log.v("Number", "Deleted Rows deleted"+noofDeletedRows +" with the specified number:" + number);
Works on version 2.2 and above.

2 comments:

Android Developers Blog

Ram's shared items