Search code examples
androidbroadcastreceiverbatterylevel

Android get how much battery used by process?


I want to get how much battery used by a process. I know how to get levels of battery but percentage is not sensitive enough for my processes. Is there a way to increase scale like 100000 or something bigger than 100? This way i believe i can get the difference accurate.

This is my pseudo code;

levelStart = getLevel();
someTestProcess();
levelEnd = getLevel();
result = levelEnd - levelStart;

Solution

  • I want to get how much battery used by a process

    You will have to build your own phone from scratch, or purchase one of the Qualcomm MDP devices and use Trepn (rather than your own code) for power measurement. Standard Android hardware does not have the means of measuring power consumption with much precision.