Welcome!

Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Java Development

Reply
Developer
Posts: 29
Registered: ‎03-16-2009
My Device: 8300

Delete call log problem

Hello,

I've implemented PhoneLogListener interface and when a new call log is added the my code handels and deletes it.
Although the call log is deleted, it remains in the "Call Log" application. I checked this in the "Messages" application.
After I restart the emulator this log disappears. Do you have any idea, where is the problem?

My code:

 

public void callLogAdded(CallLog callLog) { PhoneCallLog phoneCallLog = (PhoneCallLog)callLog; PhoneCallLogID phoneCallLogID = phoneCallLog.getParticipant(); // delete from call log history PhoneLogs phoneLogs = PhoneLogs.getInstance(); int idNormalCalls = phoneLogs.numberOfCalls(PhoneLogs.FOLDER_NORMAL_CALLS); System.out.println("================numberOfCalls: " + idNormalCalls); phoneLogs.deleteCall(idNormalCalls-1, PhoneLogs.FOLDER_NORMAL_CALLS); }

 

Thanks in advance,

Nikolay Taskov

 

 

Developer
Posts: 16,992
Registered: ‎07-29-2008
My Device: Z10 LE, Z30, Passport
My Carrier: O2 Germany

Re: Delete call log problem

iirc this issue has arisen a few times, it seems to be a bug in rims implementation.
----------------------------------------------------------
feel free to press the like button on the right side to thank the user that helped you.
please mark posts as solved if you found a solution.
@SimonHain on twitter
New Developer
Posts: 36
Registered: ‎08-04-2008
My Device: Curve 9000

Re: Delete call log problem

Hi Nikolay,

 

I would like to learn if the issue has been resolved or worked around somehow? We have the same issues in RIM5.0 and this is very annoying.

 

Andrey Zharkikh
Project Manager, Axmor Software
Developer
Posts: 16,992
Registered: ‎07-29-2008
My Device: Z10 LE, Z30, Passport
My Carrier: O2 Germany

Re: Delete call log problem

my workaround was to start a new thread, let it sleep for 2 seconds, and delete the call log then.

----------------------------------------------------------
feel free to press the like button on the right side to thank the user that helped you.
please mark posts as solved if you found a solution.
@SimonHain on twitter
New Developer
Posts: 36
Registered: ‎08-04-2008
My Device: Curve 9000

Re: Delete call log problem

Thanks for the quick reply. I do the same: wait and then delete.

The issue is that this all works for 4.x but fails for RIM 5.0. deleteCall returns success but does nothing. I actually need a workaround for this RIM5.0 specific effect.

Andrey Zharkikh
Project Manager, Axmor Software
Highlighted
Contributor
Posts: 10
Registered: ‎03-30-2010
My Device: Emulator
My Carrier: None

Re: Delete call log problem

Has anyone else had any luck with this? I've got the same situation happening. There are two places where a logged call can be viewed (at least that I have found). The first is in the Messages list that shows when a call is missed and you select "View" (Component net.rim.device.apps.api.messaging.messagelist). The second is in the phone app which comes up when the call button is pressed. The messages list is clearing as expected. The list in the phone application doesn't clear itself (net.rim.device.apps.internal.phone). If another call comes in whatever trigger happens behind the scenes will force the phone app to refresh its list, and at that time the deleted call is no longer there.

Here's the relevant code. The delay is currently set to 20 seconds to test, but the parts that work have worked with a delay as small as 1 second.

public void callIncoming(int callId) {
    super.callIncoming(callId);
    PhoneCall call = Phone.getCall(callId);
    if (shouldDelete(call)) {
        Thread t = new Thread() {
            public void run() {
                PhoneLogs phone = null;
                final int DELAY = 20000;

                try {
                    Thread.sleep(DELAY);
                    phone = PhoneLogs.getInstance();

                    int size = phone.numberOfCalls(PhoneLogs.FOLDER_MISSED_CALLS);
                    phone.deleteCall(size - 1, PhoneLogs.FOLDER_MISSED_CALLS);
                    
                    size = phone.numberOfCalls(PhoneLogs.FOLDER_NORMAL_CALLS);
                    phone.deleteCall(size - 1, PhoneLogs.FOLDER_NORMAL_CALLS);
                } catch (Exception e) {
                    // do stuff
                }
            }
        };
        t.start();
    }
}

 

 

It looks to me like the order of operations is:

1) call comes in
2) phone app builds its list of calls from the phone log (which includes the current call)
3) phone listeners are notified and can delete calls
4) missed call notification is displayed and user chooses to look at the Message list
5) messages list is built from the phone log (which does not include the deleted call)

It looks like the Phone application only rebuilds its list when a new call comes in, and that happens before a listener is given a chance to delete the call. If that's the case, is there a way to fake a call? I've tried using PhoneLogs.addCall() with a fake call, but that neither triggers a refresh of the phone list nor adds the faked call to it.

 

P.S.

Sorry for spamming multiple topics, but if anyone found a fix for this I'm hoping they'll have email subscriptions still turned on for the thread. Smiley Happy