Hacker News new | ask | show | jobs
by ultimoo 4655 days ago
Maybe a good mobile app can determine its optimization/ux strategy depending on what level the battery is currently at. I am not sure whether apps can query for battery levels though.
2 comments

They can. A number of well-built apps pause background data sync if battery is too low.

However, changing behaviour based on battery level is trickier than it seems.

* The point of reducing energy usage is to leave the user more juice for the actions that are most important to them. It could be that your app is the important one.

* Stopping expensive operations at 20% or 30% battery level means that 70-80% was already wasted. If there are good ways of optimising energy use, they should be applied at all times, and prolonging the time until you reach 20%.

* The appropriate threshold depends on what the user imagines doing for the rest of the day. If I'm travelling to another city, I disable background data in the morning to make sure I still have battery left for phone calls in the evening after heavy use of maps during the day. If I'm travelling to the office, it doesn't matter, since a charger is nearby. Predicting "time to next charging" and "use of other apps before charging" automatically for context-aware app behaviour is non-trivial.

At least on iOS you can indeed. It's available from UIDevice.

And if you're doing something that sucks up battery, you should know about it and act accordingly.

If you're not doing heavy lifting, It's just not something you should have to think about as an app developer, there are so many other areas to focus on to keep users happy.

Apple has a few WWDC sessions that talk about it I think.

Here's what they have to say in their "performance tuning" section:

https://developer.apple.com/library/ios/documentation/iphone...

The dev bytes cited in the article are specifically focused on Android development. Android provides some interesting framework classes that help with making requests efficiently to the network, both from a power and speed standpoint. A lot of these APIs are really underused (e.g. SyncAdapter) in apps right now, so Google clearly wants more devs to use it since it requires less thinking.