--
christopher tate
android framework engineer
> --
> You received this message because you are subscribed to the Google Groups
> "android-platform" group.
> To post to this group, send email to android-...@googlegroups.com.
> To unsubscribe from this group, send email to
> android-platfo...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/android-platform?hl=en.
>
Your hunch is entirely correct: holding a wakelock just to keep the
phone live in an idle state for 20 seconds is a terrible, terrible
thing to do. Do not use a wakelock for that. It's a total waste of
battery.
Instead, you should schedule a wakeup alarm for 20 realtime seconds in
the future, then use that alarm as the trigger to continue your work.
See the Alarm Manager documentation.
> Furthermore, an timer armed with CLOCK_REALTIME source will not signal in a
> near realtime if a wakelock is not acquired?
The Alarm Manager supports realtime (wall-clock time) alarms that wake
the phone for alarm processing.
> Finally, I got lateness bigger
> than 1000 seconds (more than 16 minutes) for a asked pause time of 20
> seconds. Is possible that a deep sleep last for so long with no execution
> time slice to the timer expires?
Absolutely. Android will aggressively sleep the hardware as deeply as
possible except when it is explicitly forced awake by wakelocks or
wakeup alarms.
See the Alarm Manager documentation.
The Alarm Manager supports realtime (wall-clock time) alarms that wake
the phone for alarm processing.
Absolutely. Android will aggressively sleep the hardware as deeply as
possible except when it is explicitly forced awake by wakelocks or
wakeup alarms.