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

PC200N9RA-A PC200N9RAA Memory Board
$9.99
PC200N9RA-A PC200N9RAA Memory Board pictureSPI Reader Micro SD Memory Card TF Memory Card Shield Module for Arduino T1
$1.1
SPI Reader Micro SD Memory Card TF Memory Card Shield Module for Arduino T1 picturePAR Everserv 6000 POS Point of Sale M7125-01 3GB Memory 250GB HD Card Reader
$249.99
PAR Everserv 6000 POS Point of Sale M7125-01 3GB Memory 250GB HD Card Reader pictureLOT OF 4 HYNIX HYMD232646B8J-D43 AA-A MEMORY MODULES 512MB/256MB PC2700 DDR333
$14.99
LOT OF 4 HYNIX HYMD232646B8J-D43 AA-A MEMORY MODULES 512MB/256MB PC2700 DDR333 pictureLOT OF 8 SAMSUNG ECC REGISTERED 512MB DDR PC2100 D512E266RL RAM MEMORY SERVER
$24.99
LOT OF 8 SAMSUNG ECC REGISTERED 512MB DDR PC2100 D512E266RL RAM MEMORY SERVER picture






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