On Thu, Nov 11, 2010 at 3:56 AM, Kostya Vasilyev <[email protected]> wrote:
> Are there guarantees that the wake lock is held long enough for the
> PendingIntent tied to the alarm to actually be delivered?
>
> Such as starting a service, triggering a broadcast receiver?

The WakeLock held by AlarmManager is guaranteed to be acquired for the
duration of onReceive() of a BroadcastReceiver when used with a
getBroadcast() PendingIntent.

For example, the aforementioned WakefulIntentService uses this to then
acquire its own WakeLock, which gets released only when the service is
out of work. By having the two WakeLocks overlap, the device cannot
fall asleep until the work is finished.

However, to paraphrase Ms. Hackborn, the AlarmManager WakeLock is not
guaranteed to be acquired long enough for a service to be created and
have an Intent passed to onStartCommand().

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

Android App Developer Books: http://commonsware.com/books

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