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
Highlighted
Developer
Posts: 139
Registered: ‎02-23-2012
My Device: Blackberry bold
My Carrier: Vodafone India
Accepted Solution

How to know user is on Call

Hi All,

 

I have development one push service Application in which the next requirement is that the push message should not be displayed when the user is on Call. So how to detect wheather user is busy on call?

 

Please suggest me the way to do this.

 

looking forward to here responses from you guys.

 

Thank you

 

warm regards
Mohammed Aziz
Developer
Posts: 729
Registered: ‎05-04-2011
My Device: 9700

Re: How to know user is on Call

Hi @

 

Check out this api:

http://www.blackberry.com/developers/docs/5.0.0api/net/rim/blackberry/api/phone/phonegui/PhoneScreen...

 

There is also an explanation how to use the 'AbstractPhoneListener'.

 

E.

Developer
Posts: 19,631
Registered: ‎07-14-2008
My Device: Not Specified

Re: How to know user is on Call

Even easier perhaps?

 

boolean onCall = (Phone.getActiveCall() != null);

Developer
Posts: 139
Registered: ‎02-23-2012
My Device: Blackberry bold
My Carrier: Vodafone India

Re: How to know user is on Call

Sir, where to use and how to use this code?
warm regards
Mohammed Aziz
Developer
Posts: 19,631
Registered: ‎07-14-2008
My Device: Not Specified

Re: How to know user is on Call

I thought you wanted to know if the user was on a call.  The code I gave you will tell you, and sets the boolean appropriately.  Where and how you use this is up to you isn't it?

 

I would have thought the logic in your push code would simply be

 

if (!onCall) {

// display

}

Developer
Posts: 139
Registered: ‎02-23-2012
My Device: Blackberry bold
My Carrier: Vodafone India

Re: How to know user is on Call

Yes, whatever you are saying is correct, it is the same way I used the code in my application and its working.

Thank you
warm regards
Mohammed Aziz