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: App5
OS: AJBR549
PIN: Ask
Carrier: ATT & Verizon
Posts: 20,030
Post Thanks: 54
Thanked 782 Times in 742 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





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