Chen Ganir wrote:
> I was investigating the issue of setting up a delayed activity/event,
> that will occur and trigger even if the phone is in sleep mode (wake
> up, do what you need to do, go back to sleep).
> 
> I was thinking of the following methods:
> 1. sendMessageDelayed
> 2. Timer
> 3. AlarmManager
> 
> The basic requirement is to be able to set a triger in the future, and
> be sure that this trigger wakes up the system if it is sleeping,
> perform the task, and go back to sleep.A partial wakup is required (no
> screen flickering).
> 
> Currently i'm using the sendMessageDelayed, and i keep a wake lock
> held for the timeout period (bad practice).

*Please* use AlarmManager for this!

Here is a sample project showing the use of AlarmManager and a
WakefulIntentService (allows you to take as much time as you need to do
your work and keeps the device awake just long enough to do that work):

http://github.com/commonsguy/cw-advandroid/tree/master/SystemServices/Alarm/

-- 
Mark Murphy (a Commons Guy)
http://commonsware.com | http://twitter.com/commonsguy

Android Training...At Your Office: http://commonsware.com/training

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

Reply via email to