BlackBerry Forums Support Community               

Closed Thread
 
LinkBack Thread Tools
Old 07-10-2009, 05: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, 07: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, 07: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





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