2

Is there a way to get the instant power consumption on an Android phone? Not a per process consumption, but an overall consumption.

I need it to be accessible on an app to be associated with some settings on the phone at that time.

Regarding the access of the information from an app, is it possible to get the PowerTutor data into my own app?

Minoru
  • 1,680
  • 3
  • 20
  • 44
  • You might be able to find some useful info by reading the values in /sys/class/power_supply/battery (or some other location in the /sys fs). – adelphus May 23 '16 at 20:22
  • @adelphus So I need to root the device? – Minoru May 24 '16 at 04:04
  • not necessarily - at least on my device (Nexus 4), the files in that location are world-readable. Unless your device has some evil policy preventing apps from reading the /sys location, any App should be able to read the battery information without needing special privileges. – adelphus May 24 '16 at 13:39

1 Answers1

0

As commented by @adelphus, some devices have current info on /sys fs. There is a lot of comments about CurrentWidget code, available here. The link may guide your search to especific files.

Minoru
  • 1,680
  • 3
  • 20
  • 44