Chapter 14. Managing power and resources

 

This chapter covers

  • Power management and resource usage
  • When and if to load data and resources
  • Responsible resource usage and disposal

Despite advances in technology that mean batteries last longer, disks are bigger, processors are more powerful, and devices have additional sensors, mobile devices are constrained. Resources are finite and often less than what’s available on a laptop, PC, or server. In this chapter, I cover the specifics of what you’ll need to consider for responsible power and resource usage, and how to ensure that you don’t negatively impact the experience of using your app or the device it’s running on. To do that, I’ll address four types of resources: power, disk space, processors, and sensors.

Power is limited by the capacity of the battery. When every action an app performs uses energy, there’s a trade-off between the value of the action and the device’s ability to use that power for something else. Because of this, it’s the most valuable resource to manage. Until new, longer-lasting battery technology is widespread, or all devices can be charged passively, it’s necessary for all apps to ensure they’re not wasting power.

14.1. When it’s gone, it’s gone

14.2. Do you really need it?

14.3. How often are you going to use it?

14.4. Do you still need it?

Summary