BlackBerry Forums Support Community
              

Closed Thread
 
Thread Tools
Old 08-25-2010, 03:33 AM   #1
longmilk
New Member
 
Join Date: Jun 2010
Model: 9000
PIN: N/A
Carrier: Viettel
Posts: 4
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
vivartpandey
Thumbs Must Hurt
 
Join Date: Jun 2008
Model: 9000
Carrier: Airtel
Posts: 81
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
longmilk
New Member
 
Join Date: Jun 2010
Model: 9000
PIN: N/A
Carrier: Viettel
Posts: 4
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
Dubdub
Appleinator
 
Dubdub's Avatar
 
Join Date: Nov 2005
Location: New Hampshire
Model: App6+
OS: AJBR549
PIN: Ask
Carrier: ATT & Verizon
Posts: 20,038
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



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


50-TON HYDRAULIC RAM JACK porta power type cylinder lifting jacks rams picture

50-TON HYDRAULIC RAM JACK porta power type cylinder lifting jacks rams

$119.19



Raspberry Pi 4 Model B 8 GB RAM picture

Raspberry Pi 4 Model B 8 GB RAM

$60.97



Ram Kl-1 picture

Ram Kl-1

$700.00



790-400 Robertshaw Ram-4 Ignition Module Control ***Free Shipping*** picture

790-400 Robertshaw Ram-4 Ignition Module Control ***Free Shipping***

$124.99



RAM MODULE (COMES WITH WIRING HARDNESS) picture

RAM MODULE (COMES WITH WIRING HARDNESS)

$200.00



37061 - IMPERIAL RAM MODULE -  picture

37061 - IMPERIAL RAM MODULE -

$205.00







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