It probably uses FLAG_KEEP_SCREEN_ON for its window to keep the screen on
while in its UI, and also holds a partial wake lock to keep the device
running while you are not in its UI.

On Tue, Jan 25, 2011 at 12:38 AM, Mark Murphy <mmur...@commonsware.com>wrote:

> Moreover, I doubt Google Navigation uses an explicit WakeLock,
> preferring instead to use activity-based means of keeping the screen
> on.
>
> On Tue, Jan 25, 2011 at 6:30 AM, Dianne Hackborn <hack...@android.com>
> wrote:
> > Navigation uses Service.startForeground() to say that the user is
> currently
> > aware of it so it can't be considered expendable.
> >
> > On Mon, Jan 24, 2011 at 5:33 PM, mikeee <mike.engelh...@gmail.com>
> wrote:
> >>
> >> 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<android-developers%2bunsubscr...@googlegroups.com>
> >> For more options, visit this group at
> >> http://groups.google.com/group/android-developers?hl=en
> >
> >
> >
> > --
> > Dianne Hackborn
> > Android framework engineer
> > hack...@android.com
> >
> > Note: please don't send private questions to me, as I don't have time to
> > provide private support, and so won't reply to such e-mails.  All such
> > questions should be posted on public forums, where I and others can see
> and
> > answer them.
> >
> > --
> > 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<android-developers%2bunsubscr...@googlegroups.com>
> > For more options, visit this group at
> > http://groups.google.com/group/android-developers?hl=en
>
>
>
> --
> Mark Murphy (a Commons Guy)
> http://commonsware.com | http://github.com/commonsguy
> http://commonsware.com/blog | http://twitter.com/commonsguy
>
> Android Training in London: http://bit.ly/smand1 and http://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<android-developers%2bunsubscr...@googlegroups.com>
> For more options, visit this group at
> http://groups.google.com/group/android-developers?hl=en
>



-- 
Dianne Hackborn
Android framework engineer
hack...@android.com

Note: please don't send private questions to me, as I don't have time to
provide private support, and so won't reply to such e-mails.  All such
questions should be posted on public forums, where I and others can see and
answer them.

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