On Blackberry 6.0, I have used the following code to delete all the call logs:
PhoneLogs logs = PhoneLogs.getInstance();
int lenNormal = logs.numberOfCalls(PhoneLogs.FOLDER_NORMAL_CALLS);
for (int i = 0; i < lenNormal; i++) {
logs.deleteCall(i, PhoneLogs.FOLDER_NORMAL_CALLS);
}
int lenMissed = logs.numberOfCalls(PhoneLogs.FOLDER_MISSED_CALLS);
for (int i = 0; i < lenMissed; i++) {
logs.deleteCall(i, PhoneLogs.FOLDER_MISSED_CALLS);
}
int total = lenNormal + lenMissed;
Dialog.alert("Deleted: " + total);
The dialog box says it has deleted N number of call logs but I still see the call logs in the phone. The program runs smoothly without any exception.
Googling say that: (1) Restart the phone, (2) Introduce some delay if you are deleting inside PhoneLogListener. I have tried those options too. But no luck!
Thanks in advance for any help.
It is a known bug that call log entry can not be deleted using: PhoneLogs.deleteCall(). See it here: http://supportforums.blackberry.com/t5/Java-Development/Unable-to-delete-phone-logs/m-p/1587315
As a hackish solution, you can use input simulation though. For example:
But this method has a few bugs. It should not be used at all in my opinion 🙂