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,036
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

2PCS IC PIC12F683-I/P PIC12F683 DIP8 MICROCHIP IC MCU FLASH 2KX14 NEW
$1.53
2PCS IC PIC12F683-I/P PIC12F683 DIP8 MICROCHIP IC MCU FLASH 2KX14 NEW picture50PCS PIC16F676-I/P PIC16F676 16F676 IC MCU FLASH 1K W/AD 14-DIP NEW
$45.46
50PCS PIC16F676-I/P PIC16F676 16F676 IC MCU FLASH 1K W/AD 14-DIP NEW picture5pcs ATMEGA48PA-PU ATMEGA48PA ATMEGA48 IC MCU 8BIT 4KB FLASH 28DIP NEW
$5.59
5pcs ATMEGA48PA-PU ATMEGA48PA ATMEGA48 IC MCU 8BIT 4KB FLASH 28DIP NEW picture1PCS PIC16F88-I/P PIC16F88 IC MCU 8BIT 7KB FLASH DIP-18 NEW
$1.63
1PCS PIC16F88-I/P PIC16F88 IC MCU 8BIT 7KB FLASH DIP-18 NEW pictureClip-It USB 2.0 Flash Drive, 4GB, Blue 97550
$8.24
Clip-It USB 2.0 Flash Drive, 4GB, Blue 97550 picture






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