The following is the first few sections of a chapter from The Busy Coder's Guide to Android Development, plus headings for the remaining major sections, to give you an idea about the content of the chapter.
As with any situation where you are trying to reduce your use of some system resource, you need to be able to accurately measure how much you are using that resource. Otherwise, you will have no idea whether your attempts to reduce usage are helping. It is possible that what you think will consume less of the resource actually consumes more, because of unanticipated side-effects. And, if nothing else, if the change makes your code more complicated and does not help much with resource consumption, you may be better served sticking with the original, simpler implementation.
So, when it comes to power usage, it helps to know how much power you are consuming, to determine if your attempts to use less power actually do help.
Unfortunately, compared to things like RAM and bandwidth, power measurement is a significant challenge. You really need to have hardware specifically instrumented to report power consumption for pieces of that hardware (CPU versus screen versus GPS versus mobile data radio versus …). Even if you cannot get power usage per component, just having accurate power consumption overall is not something you can necessarily get from any Android device. Alas, getting that level of power usage knowledge can be troublesome in its own right, for a variety of reasons.
This chapter will explore a few ways of measuring power usage, along with the pros and cons of that approach.
Understanding this chapter requires that you have read the core chapters and understand how Android apps are set up and operate.
The preview of this section is in an invisible, microscopic font.
The preview of this section is presently indisposed.
The preview of this section is being chased by zombies.
The preview of this section is off trying to sweet-talk the Khaleesi into providing us with a dragon.