Is your Android app getting enough sleep?

Frank Maker on Android power consumption and app etiquette.

Android developers have unprecedented access to smartphone resources, but this access carries responsibility. The potential to unwisely hog available resources, like power consumption, is a real concern.

I recently spoke with Frank Maker, a Ph.D. candidate at the University of California, Davis, who is doing systems research with Android on low-power adaptation techniques. Our interview follows.

What are the main power consumption issues Android developers should be aware of?

Frank MakerFrank Maker: The number one thing developers should do with their app is allow it to sleep. On a desktop computer, you just launch the app. It runs. You close it. You open it. But on an Android device, you actually go through states where it has focus, it doesn’t have focus, things like that. A developer needs to handle those states appropriately instead of trying to make an app work like it would on a desktop. So, if the activity loses focus and the user is going on to another application, then your app should respond to that if it has anything that’s going to use serious power. You can bundle up the state and put the app to sleep rather than letting your app’s tasks run in the background.

What are the risks associated with poor power optimization?

Frank Maker: The biggest risk is that you’ll get eaten alive in the Android Market. There are many applications in the Market that are marked one star because of bad battery performance. Even worse, if your app has a reputation for poor power use, you’re going to completely lose your market share to competitors with better reputations.

On the user side, are there tools for monitoring and managing power consumption?

Android battery screenFrank Maker: There’s a battery usage screen on Android. If you go to “Settings,” “Application Settings,” and then “Battery Use,” there’s a nice little display that shows you the ranking of the different applications. I’ve looked into it as part of our research, and while it’s simple and not super accurate, it will definitely tell you if one app is using way too much power.

Battery life basically isn’t a problem until you make it a problem. By that I mean it’s not something users think about initially, but if their battery starts going down really fast and they just installed your app, they’re generally going to put two and two together. They’ll then go to the Market and see if other people have posted about their experiences with that app.

Tell us a little bit about the research you’re doing at UC Davis. What exactly are you working on?

Frank Maker: I sit on the border between hardware and software. We’re trying to solve the problem of taking one piece of software and putting it on lots of different platforms without changing the software each time. Right now there’s a lot of refactoring that goes on when you deploy an application to a new mobile platform. We are trying to create automatic methods instead. One of the things we’ve looked at is building a model for the power usage in real-time on the device. So the idea is that when you launch the software on the device, you figure out how much energy it takes to do tasks on the device, rather than trying to know it beforehand.

Related to porting across platforms, do you think Android’s fragmentation issues will improve over time?

Frank Maker: I’m pretty confident that the Android platform will solve the fragmentation problem. Google is addressing it. For example, on the Android developer blog, Dianne Hackborn recently wrote about new tools that help you adapt to different screen sizes. There’s also the battery usage meter, which I mentioned earlier, and Android has always provided a directory structure for your resources to adapt to different configurations. You can automatically select the right resource for the right device and pinpoint exactly what you want to do for each device.

Broadly, I feel like Android is in a transition period. It’s evolving from a young, scrappy platform into something more established, and now it has to really solve these issues as it moves into adolescence.

This interview was edited and condensed.

Related:

tags: , , , ,
  • http://whysleep.org loo

    The real-time power usage would be very helpful in determining the time we use an app, and allocate appropriate time for it.