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
KushBB
Posts: 374
Registered: ‎04-07-2010
My Carrier: Airtel
Accepted Solution

Problems in Phone Listener

Hello  Every one...

 

 I am working on a project in which i need to take a Real-Time log of all incoming and outgoing calls and missed calls...

I am using Phone Listener for that but I am getting few problems with it...

 

1) public void callInitiated(int callId)  is invoked twice for every call initiated...

 

 

 public void callIncoming(int callId) {
        
          checkCall2("call Incoming", callId); 
         
    }
public void callInitiated(int callId) { 
            
          
         checkCall2("call Initiated", callId);
          
    }

 

 

 Whereas I use the same function in  public void callIncoming(int callId) which performs normally(once for every call) !!

 

2) I need to get the Duration of the calls when calls are ended.. I am Using

 

 public void callDisconnected(int callId)  &

 public void callEndedByUser(int callId)

 

in following manner:

 

 

public void callDisconnected(int callId) {
        
          PhoneCall callInfo = Phone.getCall(callid);
          
          int elapsedOut = callInfo.getElapsedTime();
          
          String  phoneNumberOut = callInfo.getPhoneNumber();
    }

 But its always throwing NullPointer Exception for "callInfo"...

 

I don't know why its happening... and If this is not the right way to achieve this, then please show me the right way.... Please Help!!!

 

Thank you  in Advance...



Press the Like button (Thumb up) on the left side to thank and
please mark the Thread as solved if its solved...
K.S
Please use plain text.
Developer
simon_hain
Posts: 15,558
Registered: ‎07-29-2008
My Carrier: O2 Germany

Re: Problems in Phone Listener

the callInitiated bug is known, you have to implement a safeguard (timestamp, or a boolean in conjunction with the callId).

 

but why don't you use the phoneloglistener? you get all information you need there, don't you?

----------------------------------------------------------
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
Please use plain text.
Developer
KushBB
Posts: 374
Registered: ‎04-07-2010
My Carrier: Airtel

Re: Problems in Phone Listener

Thanks For the Reply Simon...

 

I was not knowing about Phoneloglistener... I will try that now...

I just need number, duration and Time/Date of the logged call... I can see methods for duration and Time/date but how to get number from that??

 

Thank you in advance...

 

Regards....

 

Press the Like button (Thumb up) on the left side to thank and
please mark the Thread as solved if its solved...
K.S
Please use plain text.
Developer
simon_hain
Posts: 15,558
Registered: ‎07-29-2008
My Carrier: O2 Germany

Re: Problems in Phone Listener

http://www.blackberry.com/developers/docs/5.0.0api/net/rim/blackberry/api/phone/phonelogs/PhoneCallL...()

----------------------------------------------------------
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
Please use plain text.
Developer
KushBB
Posts: 374
Registered: ‎04-07-2010
My Carrier: Airtel

Re: Problems in Phone Listener

Thank you Simon....

 

I will give it a try today... will post again if i get a Problem....

 

Thanks A lot...

 

Regards

Press the Like button (Thumb up) on the left side to thank and
please mark the Thread as solved if its solved...
K.S
Please use plain text.