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

HP A77100-65210 Doppler Processor Board for Sonos Diagnostic Ultrasound Machine
$149.99
HP A77100-65210 Doppler Processor Board for Sonos Diagnostic Ultrasound Machine pictureCPU SIEMENS 412-2XJ05-0AB0 V5.1.1
$1095.0
CPU SIEMENS 412-2XJ05-0AB0 V5.1.1 pictureThemis XV1 115613 Intel Quad/Dual Core Xeon CPU 6RU VME Computer Board Module
$149.99
Themis XV1 115613 Intel Quad/Dual Core Xeon CPU 6RU VME Computer Board Module pictureDynamic - AC518 - .8 L MiniPro Food Processor
$183.95
Dynamic - AC518 - .8 L MiniPro Food Processor pictureHONEYWELL 30757569-001 PROCESSOR BOARD *NEW NO BOX*
$700.0
HONEYWELL 30757569-001 PROCESSOR BOARD *NEW NO BOX* picture






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