Chapter 3. Hardware Performance and Battery Life

In addition to fancy cameras, bigger and brighter screens, and faster, more compact processors, one of the biggest technical features touted with new devices is the size of the battery. Reviews of new devices chart how long the device’s battery will last compared to previous generation models. As users of smartphones, we have taken to carrying battery chargers with us—we have chargers at home, work, and in our cars—to make sure that our devices remain powered.

It is my contention that the devices are fine. The problem is that after you walk out of the store with your new phone, you begin to install apps. Yahoo! reported in 2014 that the average Android device has 95 apps installed, but only 35 are used daily.1 As these apps begin running, they utilize the various hardware functions of the device, and battery drain begins. As customers become more cognizant of this fact, we’ll see more tools to help consumers find apps that are causing high amounts of battery drain.

In this chapter, we’ll look at how apps can utilize the device hardware, and how important it is to optimize these interactions—to speed up the performance of your app. Additionally, by improving the way your app interacts with the device, you will reduce your app’s impact on battery life.

Android Hardware Features

With the number of sensors on today’s Android devices, it seems that there is nothing you cannot do with them. However, as Uncle Ben told young Peter Parker ...

Get High Performance Android Apps now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.