Turn off chatty apps.
Seems simple, right? You’re constantly recharging your phone because you’re running apps that keep sending and receiving data, which consumes power. So turn off some of those apps.
But first you have to find them. Then you have to catch them red-handed. Those are the hard parts.
Since my last post on Tips for Using Trepn™ Profiler – our tool for profiling the power consumption and performance of Android applications – several more bits of news have popped up. I’ll go over them in this and my next post.
Trepn Profiler gets a nod from Perf Like a Pirate
There’s an application performance meetup in San Francisco called Perf Like a Pirate. Google Developer Advocate Colt McAnlis presented on efficient battery use at a recent session, and at 24:13 he showed screenshots from Trepn Profiler saying, “There is a fantastic plugin for Eclipse from Qualcomm (Technologies, Inc.) that allows you to see the correlation between the network radio and battery power” (translated from pirate-speak, which I guess is the language they use at the meetup).
McAnlis cited a paper by researchers from Purdue University and Microsoft showing what some popular apps do with energy and battery life.
- Closing an unused socket upon exit can take almost one fourth of the energy the app consumes, as the cellular radio returns to its low power state.
- Serving ads can take almost one fourth as well, as the radio cycles on and off to deliver a few bytes now and then.
- The thread that includes GPS location tracking can take over 40% of the energy an app uses.
He listed seven common battery-draining behaviors and how developers can minimize their effects, such as using wakelocks carefully, transferring HTTPS message packets to a servlet efficiently, using network GPS instead of fine location GPS and designing more black pixels into your UI.
Finally, McAnlis mentions that a Nexus 5 smartphone can go about a month – A MONTH – between charges in pure standby mode. But each app chisels away at that month by pecking at the application processor, the screen and the cellular radio, often for no good reason. And you wonder why you have to charge your phone so often.
What happened to my month of standby power?
I’ve got some numbers that help explain this.
Have you heard about Google’s Project Volta? It’s no secret to Google that inadequate battery life is one of the biggest complaints from mobile users. They have launched Project Volta with the goals of looking for ways to improve the Android platform, creating new APIs and tools for more-power-efficient apps, and increasing transparency about power consumption for users.
Meghan Desai and Matthew Jay Williams presented on Project Volta at Google I/O last June. They experimented with a Nexus 5 and demonstrated the effects on battery drain of the three most demanding components:
- Application processor – The processor regularly wakes to see whether it has work to do; if not, it goes back to sleep. The check takes about one second to load code, execute it and tear the process down.
- Cellular radio – Similarly, the radio checks the network regularly, which represents a spike in activity. But because the radio stays ready for a few seconds afterward in case more packets need sending and/or receiving, it wastes a lot of power.
- Screen – This most conspicuous of power consumers is constantly turning on LEDs, painting the screen and displaying graphics.
Dividing the average power consumed by each component into the month of standby power, they calculated that you trade off roughly two minutes of standby power per hour for one second of activity per app.
Does two minutes’ worth of power really matter? If it were just one app once per hour, then it wouldn’t matter much. But 30 apps keeping these power-hungry components on for one second each would consume about 60 minutes (30 apps x 2 minutes of standby power/hour) of standby power. In other words, 30 seconds of activity (that may not even benefit you) can cost up to an hour of battery life.
That’s where your month of standby power is going.
“So what?” you say. “I don’t have 30 apps on my phone. Neither do most of my customers.” Wanna bet? I’m going to cover that in my next post, so stay tuned.
Meanwhile, here’s some homework for you:
- Watch the video of Colt McAnlis’s presentation, “Perf Like a Pirate.” I’ve jotted notes on Colt McAnlis’s presentation, “Perf Like a Pirate,” in a post in our Increase App Performance forum.
- See the video with Desai and Williams, “ Introduction to Project Volta.”
- If you don’t yet have it, install Trepn Profiler and look at where your standby power is going.