If you go into the details of your app, you will see the things it is doing
that are resulting in the approximated usage -- amount of time spent running
the CPU (as reported by the kernel), time keeping the GPS running.

On Thu, Oct 8, 2009 at 12:40 PM, dadical <[email protected]> wrote:

>
> The wording on the battery usage screen is:
>
> "Battery used by applications when running."
>
> So what does "running" mean?  Is it the time when any activity or
> service of an app is between onResume and onPause? If it means that
> when my application is consuming CPU resources (e.g., has threads that
> are active), it drains the battery by X%, then my applicatoin is doing
> very well, as it has very low totals for CPU usage.
>
> The irony here is that one of my application's primary use cases is
> actually SAVING power.  This is done by allowing the phone to blank
> the screen automatically when the phone is not within an orientation
> range associated with user interaction.  On the other hand, the
> application keeps the screen on when the phone is being held in an
> orientation that implies user interaction.  This approach works really
> well, since it effectively allows users to keep an aggressively low
> screen timeout without being annoyed to death.
>
> I'm getting the impression that my implementation of the concept has
> varying degrees of effectiveness, depending on the hardware platform.
> Many users of the Hero, for example, have reported dramatic
> improvements in battery life (anywhere from 20% to 100% improvement),
> while others claim that the app provides no power savings, while still
> others claim that it drains battery.  I suppose that this may also
> depend on phone usage patterns, but the ratings for the application
> are reasonably high (around 4.20 last time I checked)
>
> On Oct 8, 3:15 pm, Romain Guy <[email protected]> wrote:
> > I would have to check but 40% does not mean that your app used 40% of
> > the battery but that your app was responsible for 40% of the battery
> > consumption. Even if that consumption was only 3% of the total battery
> > capacity.
> >
> >
> >
> >
> >
> > On Thu, Oct 8, 2009 at 11:41 AM, dadical <[email protected]> wrote:
> >
> > > I am indeed sleeping (I'll check out the other threads, thanks for the
> > > tip).  From a battery usage perspective, I can't imagine that sleeping
> > > vs. alarm has any bearing though.   Also, I forgot to mention that
> > > when the phone's screen turns off, my background service suspends
> > > itself (via Thread.sleep(99999999999999)) until the screen is turned
> > > back on, in which case the sleep get's interrupted and the thread
> > > continues.  The net result is that the thread is only running (and
> > > consuming power, I'm assuming) when the screen is active.
> >
> > > I'm going to take Dianne's advice and do a more aggresive battery
> > > drain test, but if that turns out to not jive with the "usage meter",
> > > I think that I have chalk this one up to a really bad software
> > > approximation.
> >
> > > On Oct 8, 1:40 pm, RichardC <[email protected]> wrote:
> > >> By running your background task every 2secs your are basically keeping
> > >> the phone permanently on.  Even though your app is not using much CPU
> > >> it has to wake the phone from any sleep state every 2secs.  So it
> > >> either will not allow the phone to sleep or mostly keep it awake.
> > >> Waking the phone will power up all hardware devices that are needed
> > >> from any low power state they are currently in and reset their sleep
> > >> timeouts.
> >
> > >> Basically any background tasks (something not associated with the
> > >> current foreground activity the user is interacting with) should only
> > >> wake up very infrequently (say greater then 60mins).
> >
> > >> Also are you sleeping in your background task or using an alarm
> > >> event.  Sleeping is bad ... see lots of posts by Dianne Hackborn on
> > >> this very subject.
> >
> > >> --
> > >> RichardC
> >
> > >> On Oct 8, 5:55 pm, dadical <[email protected]> wrote:
> >
> > >> > I have an application that runs a background service.  This
> background
> > >> > service wakes and runs once every 2 seconds.  The background service
> > >> > registers as a listener with the orientation sensor with the lowest
> > >> > possible rate of event delivery (application).  When my service
> thread
> > >> > wakes it uses the latest value delivered by the sensor events, so
> > >> > there is no heavy-weight processing being done on the sensor thread.
> > >> > Furthermore, the background thread is doing very light processing
> when
> > >> > it wakes.
> >
> > >> > I've done tests that show that my background thread poses very minor
> > >> > power overhead, somewhere around 3%.  The test was basically:
>  charge
> > >> > to 100%, leave phone on for two hours with service running, record
> > >> > battery level.  Repeat with service off and compare.
> >
> > >> > However "Battery Usage" of my application is listed as some insanely
> > >> > high value  (e.g., 40%).  Over the same two hour period of the test,
> > >> > CPU usage was less than 3 seconds.
> >
> > >> > What does "battery usage" mean?  In my case, it clearly isn't an
> > >> > indication of "battery drain", but that is what the stat seems to
> > >> > imply.- Hide quoted text -
> >
> > >> - Show quoted text -
> >
> > --
> > Romain Guy
> > Android framework engineer
> > [email protected]
> >
> > Note: please don't send private questions to me, as I don't have time
> > to provide private support.  All such questions should be posted on
> > public forums, where I and others can see and answer them- Hide quoted
> text -
> >
> > - Show quoted text -
> >
>


-- 
Dianne Hackborn
Android framework engineer
[email protected]

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