0

I want to know how much batter is my app consuming(in % or mah). On our phone we can see battery consumed by different apps, how to know this within app itself? Any leads would be useful. Thanks!

Vipul J
  • 6,641
  • 9
  • 46
  • 61
  • Once you know the battery levels you can use a timer and measure the time between two changes (or initial battery level and first change). using BroadcastReceiver – Moonhead Feb 27 '14 at 10:08
  • But that is battery consumed by all the apps not just mine. – Vipul J Feb 27 '14 at 10:20
  • Oh I understand what you are saying Yeah broadcast receive is only for overall battery level. A way I would approach this problem is by closing all the other apps (although there are will always be one running) You can calculate for that – Moonhead Feb 27 '14 at 10:23
  • Maybe this post/page will be of use: http://stackoverflow.com/a/3771330/3287175 – vaultboy Feb 27 '14 at 10:47

1 Answers1

0

In the Android API doesn't support this currently. The only available documentation is the one describing how to use BatteryManager broadcasts, which only supply the overall battery level and no per-application details.

I suppose that even if there are undocumented ways to emulate what the System Settings battery manager shows, they would require rooting.