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
  • 34,719
  • 24
  • 185
  • 251
Chanaka udaya
  • 4,644
  • 4
  • 24
  • 33

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,482
  • 8
  • 60
  • 97
KOTIOS
  • 11,234
  • 3
  • 37
  • 64
  • 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