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
radpin
Posts: 21
Registered: ‎07-15-2008
Accepted Solution

detect if phone call is in progress

I have a job on a Timer (via TimerTask), and noticed that it queues up behind a phone call (because the data network is in use when the phone is on). So when the phone call ends, the jobs that were waiting to send data to the application server over http spit back all their stuff at once.

 

I'm thinking that I should do a "only execute the job if the phone isn't in use" type deal. I have my certs for signing, and am wondering if the best way to check for an active phone call is something like:

 

http://www.blackberry.com/developers/docs/4.2api/net/rim/blackberry/api/phone/Phone.html

 

if (phone.getActiveCall == null)

{  this.doStuff();  }

else

{  //phone's in use. don't do anything.   }

 

 

 

If I'm totally off track in my use of Timer, or checking for an active call, please let me know! :smileysurprised:

Please use plain text.
Developer
simon_hain
Posts: 15,558
Registered: ‎07-29-2008
My Carrier: O2 Germany

Re: detect if phone call is in progress

I use
CoverageInfo.isOutOfCoverage() || RadioInfo.isDataServiceSuspended() to put my connection queue into wait status.
PhoneListener (calldisconnected) and CoverageStatusListener are used to notify the connection queue.
In addition i use a SystemListener to restart all connections if the device was automatically turned off and on.
----------------------------------------------------------
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.