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

Measurement Computing USB-3102 4-Channel, 16-Bit Analog Voltage/Current Output
$150.0
Measurement Computing USB-3102 4-Channel, 16-Bit Analog Voltage/Current Output pictureComputer Boards Inc CIO-DAS48-PGA Analog Input Board
$600.0
Computer Boards Inc CIO-DAS48-PGA Analog Input Board  pictureExtron RGB 109xi VGA Computer Audio Video Analog Interface with ADSP
$19.99
Extron RGB 109xi VGA Computer Audio Video Analog Interface with ADSP pictureExtron RGB 202xi ADSP Universal Analog, ECL and TTL Computer-Video Interface
$29.99
Extron RGB 202xi ADSP Universal Analog, ECL and TTL Computer-Video Interface pictureMeasurement Computing PCI-DAS1602/16 Analog and Digital I/O Board PCI Card
$250.0
Measurement Computing PCI-DAS1602/16 Analog and Digital I/O Board PCI Card picture






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