So you're saying Google Navigation *doesn't* use a wakelock and
continually receive gps updates or that it's somehow an evil
application because it uses the battery quickly?




On Jan 24, 5:24 pm, Mark Murphy <mmur...@commonsware.com> wrote:
> On Fri, Jan 21, 2011 at 8:11 AM, mikeee <mike.engelh...@gmail.com> wrote:
> > I've got an app that starts a service in order to receive location
> > updates from the LocationManager.    The use case is the service needs
> > to be running all the time and as such it acquires a
> > PowerManager.PARTIAL_WAKE_LOCK in the onCreate() of the Service.
>
> This sounds evil from the standpoint of battery life, if nothing else.
>
> > But it seems from testing on several different phones and user
> > feedback that the Service is still being put to sleep as the location
> > notifications will stop if the application isn't in the foreground.
>
> Android does not put applications to sleep. In your case, Android is
> probably terminating your service for being everlasting and using a
> perpetual WakeLock.
>
> > This effectively renders the app ineffective for the task at hand.
> > I've read posts about using an Alarm to simulate a pseudo cron job but
> > I don't really need to be woken up in order to do a task, the app
> > needs to run code based on the location manager calling
> > onLocationChanged the service that the users position has changed.
>
> You can experiment with my LocationPoller, which is designed for your 
> scenario:
>
> https://github.com/commonsguy/cwac-locpoll
>
> > yet the fact that it
> > effectively stops running in some cases is causing problems for the
> > users.
>
> That is because you cannot write everlasting services. Please use
> AlarmManager and something (LocationPoller or your own design) to
> write so you do not have a service and WakeLock in memory all of the
> time.
>
> --
> Mark Murphy (a Commons 
> Guy)http://commonsware.com|http://github.com/commonsguyhttp://commonsware.com/blog|http://twitter.com/commonsguy
>
> Android Training in London:http://bit.ly/smand1andhttp://bit.ly/smand2

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