I am developing a informational android app where I want to read the charge rate in milli-amps when the device is charging. I have seen other apps that can do this such as Ampere.
I believe the info should be in directory /sys/class/power_supply/battery
which of these files are relevant in accomplishing this, and how could I calculate charge rate in mA from this?
2 Answers
Answers 1
According to the linux kernel doc, you can read the charge rate from /sys/class/power_supply/battery/current_now
. The value is in µA, so you should scale it by 1000. Negative values mean that the device is charging.
Answers 2
directory may change according to the phone manufacturer. See this link for supporting more devices currentwidget
And above API 21+ charge counter and energy counter is implemented: see the doc
0 comments:
Post a Comment