Android BATTERY_STATUS_NOT_CHARGING and BATTERY_STATUS_DISCHARGING


In Android programming, to know the status of the battery, write the code as shown below.

According to the reference, the values of the status are five of the following.

BATTERY_STATUS_CHARGING
BATTERY_STATUS_DISCHARGING
BATTERY_STATUS_FULL
BATTERY_STATUS_NOT_CHARGING
BATTERY_STATUS_UNKNOWN

To determine whether during charging, we describe below.

We can understand that “battery is charging” or “battery is full, so can not be charged any more”.

Then, when we determine whether during discharging, what’s the difference of the following two ?

BATTERY_STATUS_DISCHARGING
BATTERY_STATUS_NOT_CHARGING

I investigated the value of “status” when external power is not connected (= discharging) to my terminals.

SO-02C (Xperia acro/Android2.3): BATTERY_STATUS_DISCHARGING
SO-03C (Xperia ray/Android2.3): BATTERY_STATUS_DISCHARGING
FAR70A (Fujitu Arrows/Android4.0): BATTERY_STATUS_NOT_CHARGING
TF-201 (Asus Eee Pad/Android4.1): BATTERY_STATUS_NOT_CHARGING

I guess that the smartphones will return BATTERY_STATUS_DISCHARGING and the tablets (of 10inches) will return BATTERY_STATUS_NOT_CHARGING. (I want to know which values the tables of 7inches or Android3.2 will return. But I’m not in possession of them.)

Therefore, when examining whether the terminal is discharging, we write as follows.

* I was exposed to here the code to check the staus of the terminal.


Your email address will not be published.