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
New Developer
Posts: 54
Registered: ‎03-04-2009
My Device: Not Specified

Issue with PhoneLogListener not receiving callbacks

I have an application that creates a PhoneCallLog instance which I then add to the PhoneLogs container.

PhoneLogs phoneLogs = PhoneLogs.getInstance();
PhoneCallLog phoneCallLog = new PhoneCallLog(new Date(1236163590924L), PhoneCallLog.TYPE_PLACED_CALL, 10, PhoneCallLog.STATUS_BUSY, new PhoneCallLogID("9920116246"), "");
phoneLogs.addCall(phoneCallLog);

 

After invoking addCall() I receive the callback callLogAdded() in my PhoneLogListener implementer. The problem is when I access my phone's call log list manually and delete the call log (added using the above code) I don't receive the callback callLogRemoved() in my Listener class though the listener is registered. On restarting the device, the call log reappears in the list which implies it never got deleted in the first place (though the UI gave a different picture) and hence the call back was also not received by my listener perhaps. Also instead of adding a phone call log through my code I got it added via the phone itself by making an outgoing call. When I delete the call log in this case I am getting a call back.

 

I am using ver 4.2.1 and also tries using ver 4.6 but the problem persists. Is this a known issue in blackberry or I have missed something. Plz help...

Developer
Posts: 432
Registered: ‎02-23-2009
My Device: Not Specified

Re: Issue with PhoneLogListener not receiving callbacks

You can take help from this link:

 

http://www.blackberry.com/knowledgecenterpublic/livelink.exe/fetch/2000/348583/800332/800536/How_To_...

 

 


Press the kudos button to thank the user who helped you.

If your problem was get solved then please mark the thread as "Accepted solution".

 

 

Deepesh Gupta
New Developer
Posts: 54
Registered: ‎03-04-2009
My Device: Not Specified

Re: Issue with PhoneLogListener not receiving callbacks

Thanks for your reply. However my issue is different. I don't have problems as far as using the phone call logs api is concerned. I am able to add a call log entry using the addcall() api but when I delete that entry from my device (by going to the call log list and using the Delete option) the UI gets updated with the entry being removed, however my PhoneCallLog listener does not get a callback in callLogRemoved() though it is registered. When I restart my device I can see the call log entry again in my call log list which implies the call log entry never got deleted in the first place though the UI was updated. I want to know if this is a known issue with Blackberry? If so, then is there any workaround for the same?
BlackBerry Development Advisor
Posts: 15,727
Registered: ‎07-09-2008
My Device: BlackBerry PRIV
My Carrier: Bell

Re: Issue with PhoneLogListener not receiving callbacks

I haven't been able to reproduce this behaviour.  Please verify that you are viewing the call logs within the Phone application.  To do so start the Phone app, select Options from the menu, click on General Options and check the setting for Phone List View.  This should be set to Call Log.

 

If this is correct, what is the full 4 digit BlackBerry handheld software version are you testing on?  You can find this under Options, About on the BlackBerry Smartphone.

Mark Sohm
BlackBerry Development Advisor

Please refrain from posting new questions in solved threads.
Problem solved? Click the Accept As Solution button.
Found a bug? Report it using Issue Tracker
New Developer
Posts: 54
Registered: ‎03-04-2009
My Device: Not Specified

Re: Issue with PhoneLogListener not receiving callbacks

[ Edited ]

The phone list view was already set as Call Log in my case. So the call logs were being viewd within the Phone application. The 4 digit software version of my Blackberry 8800 is 4.2.1.68.

Unfortunately the bug is replicable whenever I run this code:
 

public class CallLogTester extends Application implements PhoneLogListener {

public static final long app_guid = 45614127246L;
private static CallLogTester tester;

public static void main(String[] args) {

try {

RuntimeStore appReg = RuntimeStore.getRuntimeStore();
synchronized (appReg) {
if (appReg.get(app_guid) == null) {
CallLogTester tester = new CallLogTester();
appReg.put(app_guid, tester);
PhoneLogs.addListener(tester);
}
}
testCallLog();
tester.enterEventDispatcher();

}

catch(Exception ex) {

System.exit(1);

}

}

private static void testCallLog() {
PhoneLogs phoneLogs = PhoneLogs.getInstance();
PhoneCallLog phoneCallLog = new PhoneCallLog(new
Date(1236163590924L),
PhoneCallLog.TYPE_PLACED_CALL, 10,
PhoneCallLog.STATUS_BUSY, new
PhoneCallLogID("9920116246"), "");
phoneLogs.addCall(phoneCallLog);

int num_of_normal_calls =
phoneLogs.numberOfCalls(PhoneLogs.FOLDER_NORMAL_CALLS);

for (int i = 0; i < num_of_normal_calls; i++) {
phoneLogs.deleteCall(i--, PhoneLogs.FOLDER_NORMAL_CALLS);
num_of_normal_calls =
phoneLogs.numberOfCalls(PhoneLogs.FOLDER_NORMAL_CALLS);
}

 

System.exit(0);

}

public void callLogAdded(CallLog arg0) {
System.out.println("Callback is received here when addCall()" +
" is invoked");
}

public void callLogUpdated(CallLog arg0, CallLog arg1) {
}

public void callLogRemoved(CallLog arg0) {
System.out.println("Callback is not received here when" +
" deleteCall() is invoked");
}
}

 

 

In testCallLog() I simply add a call log entry using phoneLogs.addCall(phoneCallLog) api for which I receive a callback in callLogAdded(). Next I delete the same call by invoking the deleteCall() api. However in this case I am not receiving a callback in callLogRemoved() which I should. When I check the call log entry from the phone application UI, I can't see the entry but on restarting the phone, the entry reappears implying that it never got deleted in the first place.

This bug is always replicable unless a new call log gets added from the phone application directly instead of my code as shown.

 

This looks like an issue with the Blackberry platform. Can you plz verify and confirm?

Thanks.

 

 

 

 

 

Message Edited by chintan_kanal on 03-12-2009 11:48 AM
BlackBerry Development Advisor
Posts: 15,727
Registered: ‎07-09-2008
My Device: BlackBerry PRIV
My Carrier: Bell

Re: Issue with PhoneLogListener not receiving callbacks

Remove the exit(0) call at the end of your application.  The application looks to be exiting before the listener fires the delete notification method.
Mark Sohm
BlackBerry Development Advisor

Please refrain from posting new questions in solved threads.
Problem solved? Click the Accept As Solution button.
Found a bug? Report it using Issue Tracker
New Developer
Posts: 54
Registered: ‎03-04-2009
My Device: Not Specified

Re: Issue with PhoneLogListener not receiving callbacks

I tried removing the System.exit(0) call. I even tried performing the operations in testCallLog() in a different thread but the problem persists. I have no doubt about this. Can you please try to replicate using the code I posted earlier.

If you note the testCallLog() method in my code I am simply adding a new call log and then deleting it. If I check the phone's call log list it won't show me the deleted call log, however it does when I restart my device which means the call log never got deleted actually, perhaps the reason I didn't received the call back. This happens assuming you've added the call log through the code and that the call log was not added automatically via the phone app.

BlackBerry Development Advisor
Posts: 15,727
Registered: ‎07-09-2008
My Device: BlackBerry PRIV
My Carrier: Bell

Re: Issue with PhoneLogListener not receiving callbacks

I was testing this using the code you pasted above.  Are you able to reproduce this on newer versions (such as 4.5.0 or higher)?
Mark Sohm
BlackBerry Development Advisor

Please refrain from posting new questions in solved threads.
Problem solved? Click the Accept As Solution button.
Found a bug? Report it using Issue Tracker
New Developer
Posts: 54
Registered: ‎03-04-2009
My Device: Not Specified

Re: Issue with PhoneLogListener not receiving callbacks

On Blackberry Bold ie. OS ver4.6.x it works fine. So is this a known issue in ver 4.2.x?
New Developer
Posts: 54
Registered: ‎03-04-2009
My Device: Not Specified

Re: Issue with PhoneLogListener not receiving callbacks

Can you please confirm if this is a known issue in Blackberry v4.2.x?