BlackBerry Forums Support Community
              

Closed Thread
 
LinkBack Thread Tools
Old 07-10-2009, 04:56 PM   #1 (permalink)
Knows Where the Search Button Is
 
pfowler's Avatar
 
Join Date: May 2008
Location: Palo Alto, CA
Model: 8310
PIN: N/A
Carrier: ATT
Posts: 39
Post Thanks: 1
Thanked 0 Times in 0 Posts
Default Detecting Device Idle

Please Login to Remove!

As a part of further investigation of my problem Posted Here, I've discovered that our software is doing some heavy processing while the device is in use. The software runs in the background processing different events on the device.

I've written up a method to check if the device is idle before processing, and wanted to run the code by a few more sets of eyes.

I've implemented the following:
Code:
	public static boolean isDeviceIdle() {
		return (DeviceInfo.isInHolster() || DeviceInfo.getIdleTime() > ConfigurationStore.getTransmitDelay())
			&& Phone.getActiveCall() == null;
	}
Is this an efficient way of determining if the device is idle? Is there a better way of determining if there is an active phone call?

Thanks for the help,
Pat
Offline  
Old 07-10-2009, 06:18 PM   #2 (permalink)
BlackBerry Extraordinaire
 
Join Date: Jan 2006
Model: LEZ10
OS: 10.0.10
Carrier: Rogers CA
Posts: 1,704
Post Thanks: 20
Thanked 77 Times in 68 Posts
Default

Why not just Thread.setPriority(Thread.MIN_PRIORITY), yield frequently (do your work in small steps) and let the OS figure out how much time to give you.
__________________
My other Blackberry is a PlayBook.
Offline  
Old 07-10-2009, 06:38 PM   #3 (permalink)
Knows Where the Search Button Is
 
pfowler's Avatar
 
Join Date: May 2008
Location: Palo Alto, CA
Model: 8310
PIN: N/A
Carrier: ATT
Posts: 39
Post Thanks: 1
Thanked 0 Times in 0 Posts
Default

there's a red mark in the shape of my hand on my forehead from slapping it so hard. Thanks for the idea, so obvious!
Offline  
Closed Thread


Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

VISHAY VSKH56/12 THYRISTOR PHASE CONTROL MODULE 60A
$24.99
VISHAY VSKH56/12 THYRISTOR PHASE CONTROL MODULE  60A pictureNEW THYRISTOR 5961-00-609-0755
$150.0
NEW THYRISTOR 5961-00-609-0755 pictureCA3097E RCA Thyristor Transistor Array IC 14 Pin DIP Plastic - NOS Qty 1
$7.99
CA3097E RCA Thyristor Transistor Array IC 14 Pin DIP Plastic - NOS Qty 1 picture20pcs MAC97A6 Thyristor TRIAC 400V 0.6 Amp 3-Pin TO-92 USA
$2.95
20pcs MAC97A6 Thyristor TRIAC 400V 0.6 Amp 3-Pin TO-92 USA pictureLarge SCR Thyristor Diode, Westcode 9029 254AT, 6 available. Used. About 2000A.
$109.0
Large SCR Thyristor Diode, Westcode 9029 254AT, 6 available. Used. About 2000A. picture






Copyright 2004-2016 BlackBerryForums.com.
The names RIM and BlackBerry are registered Trademarks of BlackBerry Inc.