The Airsource Blog

Your application drained my battery

A client rings up and says 'your application killed my battery. I ran it, and within 30 minutes my battery was flat'. How do you prove that it's not your application at fault? Now, bearing in mind most mobile phone batteries last for a week or more on standy, even if you some long and very tedious tests, it's going to take you forever to prove, well, nothing really. Certainly nothing that will convince the client.

This was a real situation for me a couple of years ago. Product management were breathing down my neck with all kinds of 'helpful' suggestions. After two hours of doing nothing but responding to their emails I shut my office door (well, we had an open-plan office, so I told my manager to handle the emails and not let anyone talk to me), and sat down to think about it. Five minutes later I had a solution.

For some reason we had a brand spanking new power supply hanging around the lab. I used to work at Cambridge Consultants, where besides writing software I did a lot of playing with scopes and soldering irons. I like software, but I really like software when I have complete control over the device. So anything hardware-ish caught my eye.

I got a couple of microprobes, figures out which lines were power and ground on the battery, and then hooked up the PSU in place of the battery, set to constant voltage and variable current. Then I measured the normal standby current on the phone which gave me a baseline to test against. Then I measured the current drawn by my application going at full-burn sending network traffic. The current was much higher, obviously, but still nowhere near that needed to drain the battery in half an hour. After all, that's an order of magnitude less than the talk time! Then I watched the current drawn in standby mode, seeing the occasional spike as the app woke up to do some housekeeping and contact the server, using perfectly reasonable amounts of current. This was quickly followed by a return to normal standby levels.

These results were enough to convince me, and more importantly the client, that the bug report was completely bogus. We're guessing that someone charged a phone, saw the battery die quickly, but didn't notice that the cleaner has unplugged the charger in order to do the vacuum cleaning.