> I need my TimerTask to execute (a BlueTooth operation every few
> minutes) even while the display is sleeping.

If the device is not on a charger, you might blow through the user's
battery before they wake up, if you use a polling period of that
frequency.

I strongly encourage you to watch Jeff Sharkey's presentation from Google
I/O 2009 entitled "Coding for Life...Battery Life, That Is".

> How do i achieve this (eventually using something else instead of a
> TimerTask) ?

You will need AlarmManager and a WakeLock. I would also recommend getting
at the ACTION_BATTERY_STATE sticky broadcast Intent to keep an eye on the
battery level, and throttle back your polling period (or stop it
altogether) when the battery reaches a user-specified level.

-- 
Mark Murphy (a Commons Guy)
http://commonsware.com
Android App Developer Books: http://commonsware.com/books.html


-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to