BlackBerry Forums Support Community               

Closed Thread
 
LinkBack Thread Tools
Old 08-25-2010, 03:33 AM   #1 (permalink)
New Member
 
Join Date: Jun 2010
Model: 9000
PIN: N/A
Carrier: Viettel
Posts: 4
Post Thanks: 0
Thanked 0 Times in 0 Posts
Default Question about Thread?

Please Login to Remove!

I'm developing an application that automatically check mail every 10 minutes (like Gmail). I've used background checkMailThread, it executes every 10 minutes. I don't know how Thread.sleep() will effect the CPU and does this Thread drains my battery?
Posted via BlackBerryForums.com Mobile
Offline  
Old 08-25-2010, 04:08 AM   #2 (permalink)
Thumbs Must Hurt
 
Join Date: Jun 2008
Model: 9000
Carrier: Airtel
Posts: 81
Post Thanks: 0
Thanked 0 Times in 0 Posts
Default

instead of sleep use timertask.

Code:
Timer timer = new Timer();
			TimerTask timerTask = new TimerTask(){

				public void run() {
					// check email
					
				}
				
			};
			timer.scheduleAtFixedRate(timerTask, 1000, 10*60*1000);
__________________
blog.vimviv.com
Offline  
Old 08-25-2010, 04:38 AM   #3 (permalink)
New Member
 
Join Date: Jun 2010
Model: 9000
PIN: N/A
Carrier: Viettel
Posts: 4
Post Thanks: 0
Thanked 0 Times in 0 Posts
Default

Quote:
Originally Posted by vivartpandey View Post
instead of sleep use timertask.

Code:
Timer timer = new Timer();
			TimerTask timerTask = new TimerTask(){

				public void run() {
					// check email
					
				}
				
			};
			timer.scheduleAtFixedRate(timerTask, 1000, 10*60*1000);
TimerTask drains less battery and CPU, is it true?
Posted via BlackBerryForums.com Mobile
Offline  
Old 08-25-2010, 06:37 AM   #4 (permalink)
Appleinator
 
Dubdub's Avatar
 
Join Date: Nov 2005
Location: New Hampshire
Model: App6+
OS: AJBR549
PIN: Ask
Carrier: ATT & Verizon
Posts: 20,038
Post Thanks: 52
Thanked 777 Times in 737 Posts
Default

What is your planned use? RIM does this automatically now.
__________________
-->>BB FAQ

-->>Stinsonddog's Tip Site!

-->>Twitter


If someone helps, tell them by clicking the Thanks button.!!
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

TWO *NEW* SMC NVZ3240-5MZ-M5 Solenoid Valves and 8 SMC KQ2H07-34S Fittings
$39.95
TWO *NEW* SMC NVZ3240-5MZ-M5 Solenoid Valves and 8 SMC KQ2H07-34S Fittings pictureMac Valves PME-221AAAB PME221AAAB Solenoid Valve
$39.95
Mac Valves PME-221AAAB PME221AAAB Solenoid Valve picture(NEW) Numatics 110-120V Solenoid Valve 081SA400K000030
$69.99
(NEW) Numatics 110-120V Solenoid Valve 081SA400K000030 pictureNEW FESTO MOCH Solenoid Operated Directional Valve MOCH-3-1/4 NNB
$149.99
NEW FESTO MOCH Solenoid Operated Directional Valve MOCH-3-1/4 NNB picture1/2 Inch Brass Electric Solenoid Valve 12V DC for Air Water Gas FKM/VITON
$16.27
1/2 Inch Brass Electric Solenoid Valve 12V DC for Air Water Gas FKM/VITON picture






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