BlackBerry Forums Support Community               

Closed Thread
 
LinkBack Thread Tools
Old 07-29-2008, 10:18 AM   #1 (permalink)
Thumbs Must Hurt
 
Join Date: May 2007
Location: Bulgaria
Model: none
PIN: N/A
Carrier: Mtel
Posts: 150
Post Thanks: 0
Thanked 0 Times in 0 Posts
Default I am looking for a listener !!!???

Please Login to Remove!

Is there any listener, that can observe any trackwheel/key click. I want to made my application (running in background or foreground) starts some actions after 5 minutes (for example) after a key/trackwheel was pressed. Is there any system timer that increases its count until key is pressed, when a key is pressed the timer, should initialize its counter to 0? If I have to make my own timer, I think this will discharge the phone battery faster. What do you think about it ? Thanks !
Offline  
Old 07-29-2008, 10:28 AM   #2 (permalink)
CrackBerry Addict
 
Join Date: Apr 2005
Location: hamburg, germany
Model: 8900
Carrier: o2
Posts: 838
Post Thanks: 0
Thanked 0 Times in 0 Posts
Default

nope, you can only get these events if your uiapplication is in the foreground
__________________
java developer, Devinto, hamburg/germany
Offline  
Old 07-29-2008, 10:39 AM   #3 (permalink)
BlackBerry Extraordinaire
 
Join Date: Mar 2008
Location: Austin, TX
Model: 9700
PIN: N/A
Carrier: T-Mobile
Posts: 1,644
Post Thanks: 0
Thanked 34 Times in 33 Posts
Default

Take a look at DeviceInfo.getIdleTime().
Offline  
Old 07-29-2008, 10:47 AM   #4 (permalink)
Thumbs Must Hurt
 
Join Date: May 2007
Location: Bulgaria
Model: none
PIN: N/A
Carrier: Mtel
Posts: 150
Post Thanks: 0
Thanked 0 Times in 0 Posts
Default

Yes, I saw it....but I have to check every minute if the result of that function equals the time i set (5 minutes i told before). The other idea that came to my mind is to make a timer that increases itself then if key is pressed gets its counter to 0, and when the timer count equals the time I set, the actions to be done. Maybe these are the only two possibilities. Which is better having in mind speed and battery discharging? Thanks !
Offline  
Old 07-29-2008, 12:14 PM   #5 (permalink)
Talking BlackBerry Encyclopedia
 
Join Date: Oct 2006
Model: 7103
Carrier: Verizon
Posts: 259
Post Thanks: 0
Thanked 0 Times in 0 Posts
Default

for reasons I never thought were useful until now, all the action methos (keychar, keycharUnhandled, trackwheelRoll,click) pass in 'time' (measured from device start time). you could use that here
Offline  




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