On Sat, Mar 28, 2009 at 4:37 PM, Mark Murphy <mmur...@commonsware.com>wrote:

> Have you tried using setReferenceCounted(true) on the WakeLock?
>
No, I didn't know about that. Sounds interesting. Thanks for the pointer.


> In the scenario you described:
>
> -- The activity tells the service, "yo! sync me!"
>
> -- The service acquires the reference-counted WakeLock (count now = 1)
>
> -- The alarm goes off and starts the service
>
> -- The started service acquires the *same* reference-counted WakeLock
> (count now = 2)
>
> -- The work from the activity-initiated sync wraps up and releases the
> WakeLock (count now = 1 and we are still locked)
>
Acquiring the wake lock in the service might be ok in the real world, but
conceptually this is too late. The OS could have put the phone to sleep
between the alarm going off and the service acquiring the wake lock.

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