Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android : Difference between BATTERY_STATUS_DISCHARGING and BATTERY_STATUS_NOT_CHARGING

Tags:

android

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 ?

like image 972
Heshan Perera Avatar asked Apr 05 '12 05:04

Heshan Perera


People also ask

What is battery manager in Android?

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.

What is battery manager?

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.


2 Answers

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.

like image 78
abeboparebop Avatar answered Nov 23 '22 23:11

abeboparebop


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.

like image 37
Jo-Anne Avatar answered Nov 23 '22 23:11

Jo-Anne