0

I am developing an application in which i want to delete the entry in the call log which is the last outgoing call number. I need to do this when i am finished the outgoing call. The issue I am facing is I cannot retrieve the last dialled number from CallLog when the call is finished. I have used the PhoneStateListener and tried to capture the IDLE state. Still no luck.

Cœur
  • 37,241
  • 25
  • 195
  • 267
Chanaka udaya
  • 5,134
  • 4
  • 27
  • 34

1 Answers1

0

make sure u have following permission in manifast.xml:

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

for Deleting Calllogs for particular number try this way:

public void DeleteCallLogByNumber(String number) {   
    String queryString="NUMBER="+number; 
    this.getContentResolver().delete(CallLog.Calls.CONTENT_URI,queryString,null);
    }  
}
Sagar Maiyad
  • 12,655
  • 9
  • 63
  • 99
KOTIOS
  • 11,177
  • 3
  • 39
  • 66
  • I have tried this. But the problem is I cannot get the number to be deleted when the call is finished. It take some time to populate the number in call log. – Chanaka udaya Jun 21 '13 at 12:46