I want to know the difference between the two flags
BatteryManager.BATTERY_STATUS_DISCHARGING
And
BatteryManager.BATTERY_STATUS_NOT_CHARGING
I developed an application that uses these two flags, and I expected to see "discharging" when I unplugged the phone from the charger, but instead it simply says "not charging".
What is the difference between the two ?
The BatteryManager class contains strings and constants used for values in the android. content. Intent#ACTION_BATTERY_CHANGED Intent, and provides a method for querying battery and charging properties.
A battery management system (BMS) is an electronic regulator that monitors and controls the charging and discharging of rechargeable batteries. Battery management systems of various types are used in most devices that use rechargeable batteries.
I can find no clear definition of the two in the Android APIs or elsewhere online.
My best guess is that BATTERY_STATUS_DISCHARGING
indicates that the device is actively draining power, while BATTERY_STATUS_NOT_CHARGING
indicates that the device is plugged in but is not receiving enough power to actually charge -- for instance, if it is plugged into a low-power USB port.
However, there are other reports from developers that certain devices never return BATTERY_STATUS_DISCHARGING
, even when completely unplugged: https://groups.google.com/a/chromium.org/forum/#!topic/chromium-reviews/1AjyPYt0tQs
In particular, the Nexus 7 2013 seems to have this bug (confirmed by personal experience): https://code.google.com/p/android/issues/detail?id=124768.
Presumably, you ran into a similar bug.
The other option for not charging is simply that the battery is full, hence no need for charging or that there is no battery at all.
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