Mariano Kamp wrote: > On Sat, Mar 28, 2009 at 4:37 PM, Mark Murphy <[email protected] > <mailto:[email protected]>> 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.
Ah, yeah, right -- the stuff I already have going. The BroadcastReceiver needs to have access to the WakeLock. If this is a registerReceiver() case, it can use the same object without resorting to a static data member; otherwise, it'll still need one. I'm working on this stuff right now. Well, OK, not right now, since I'm typing this reply, but I'll be working on it again as soon as I send this. Assuming, of course, that my personal wake lock doesn't lapsZzzzzzzzzzzzzzzzzzzzzzzzzzzzzz... ;-) -- Mark Murphy (a Commons Guy) http://commonsware.com | http://twitter.com/commonsguy _The Busy Coder's Guide to Android Development_ Version 2.0 Available! --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---

