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?
Plug in your phone. Give it a moment to see how fast it's charging. Open your phone's Settings app. Under "Battery," see how much charge you have left, and about how long until a full charge.
The Play Store listing includes devices the app isn't compatible with, as well as general guidance of the app not being capable of providing precision accuracy. In other words, don't throw away your multimeter.
Method 1: Ampere One of the quickest and easiest ways to test how fast your smartphone is charging or discharging is by using the Ampere app, which is available free through the Android Play Store.
Put your phone in Airplane Mode before you plug it in. Testing suggests it could reduce the amount of time needed for a full charge by as much as 25%. To put your phone into Airplane Mode, simply swipe down on the notification bar and tap the Airplane mode icon.
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.
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
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With