Please note that the contents of this offline web site may be out of date. To access the most recent documentation visit the online version .
Note that links that point to online resources are green in color and will open in a new window.
We would love it if you could give us feedback about this material by filling this form (You have to be online to fill it)
Android APIs
public class

BatteryManager

extends Object
java.lang.Object
   ↳ android.os.BatteryManager

Class Overview

The BatteryManager class contains strings and constants used for values in the ACTION_BATTERY_CHANGED Intent.

Summary

Constants
int BATTERY_HEALTH_COLD
int BATTERY_HEALTH_DEAD
int BATTERY_HEALTH_GOOD
int BATTERY_HEALTH_OVERHEAT
int BATTERY_HEALTH_OVER_VOLTAGE
int BATTERY_HEALTH_UNKNOWN
int BATTERY_HEALTH_UNSPECIFIED_FAILURE
int BATTERY_PLUGGED_AC Power source is an AC charger.
int BATTERY_PLUGGED_USB Power source is a USB port.
int BATTERY_PLUGGED_WIRELESS Power source is wireless.
int BATTERY_STATUS_CHARGING
int BATTERY_STATUS_DISCHARGING
int BATTERY_STATUS_FULL
int BATTERY_STATUS_NOT_CHARGING
int BATTERY_STATUS_UNKNOWN
String EXTRA_HEALTH Extra for ACTION_BATTERY_CHANGED : integer containing the current health constant.
String EXTRA_ICON_SMALL Extra for ACTION_BATTERY_CHANGED : integer containing the resource ID of a small status bar icon indicating the current battery state.
String EXTRA_LEVEL Extra for ACTION_BATTERY_CHANGED : integer field containing the current battery level, from 0 to EXTRA_SCALE .
String EXTRA_PLUGGED Extra for ACTION_BATTERY_CHANGED : integer indicating whether the device is plugged in to a power source; 0 means it is on battery, other constants are different types of power sources.
String EXTRA_PRESENT Extra for ACTION_BATTERY_CHANGED : boolean indicating whether a battery is present.
String EXTRA_SCALE Extra for ACTION_BATTERY_CHANGED : integer containing the maximum battery level.
String EXTRA_STATUS Extra for ACTION_BATTERY_CHANGED : integer containing the current status constant.
String EXTRA_TECHNOLOGY Extra for ACTION_BATTERY_CHANGED : String describing the technology of the current battery.
String EXTRA_TEMPERATURE Extra for ACTION_BATTERY_CHANGED : integer containing the current battery temperature.
String EXTRA_VOLTAGE Extra for ACTION_BATTERY_CHANGED : integer containing the current battery voltage level.
Public Constructors
BatteryManager ()
[Expand]
Inherited Methods
From class java.lang.Object

Constants

public static final int BATTERY_HEALTH_COLD

Constant Value: 7 (0x00000007)

public static final int BATTERY_HEALTH_DEAD

Added in API level 1

Constant Value: 4 (0x00000004)

public static final int BATTERY_HEALTH_GOOD

Added in API level 1

Constant Value: 2 (0x00000002)

public static final int BATTERY_HEALTH_OVERHEAT

Added in API level 1

Constant Value: 3 (0x00000003)

public static final int BATTERY_HEALTH_OVER_VOLTAGE

Added in API level 1

Constant Value: 5 (0x00000005)

public static final int BATTERY_HEALTH_UNKNOWN

Added in API level 1

Constant Value: 1 (0x00000001)

public static final int BATTERY_HEALTH_UNSPECIFIED_FAILURE

Added in API level 1

Constant Value: 6 (0x00000006)

public static final int BATTERY_PLUGGED_AC

Added in API level 1

Power source is an AC charger.

Constant Value: 1 (0x00000001)

public static final int BATTERY_PLUGGED_USB

Added in API level 1

Power source is a USB port.

Constant Value: 2 (0x00000002)

public static final int BATTERY_PLUGGED_WIRELESS

Power source is wireless.

Constant Value: 4 (0x00000004)

public static final int BATTERY_STATUS_CHARGING

Added in API level 1

Constant Value: 2 (0x00000002)

public static final int BATTERY_STATUS_DISCHARGING

Added in API level 1

Constant Value: 3 (0x00000003)

public static final int BATTERY_STATUS_FULL

Added in API level 1

Constant Value: 5 (0x00000005)

public static final int BATTERY_STATUS_NOT_CHARGING

Added in API level 1

Constant Value: 4 (0x00000004)

public static final int BATTERY_STATUS_UNKNOWN

Added in API level 1

Constant Value: 1 (0x00000001)

public static final String EXTRA_HEALTH

Added in API level 5

Extra for ACTION_BATTERY_CHANGED : integer containing the current health constant.

Constant Value: "health"

public static final String EXTRA_ICON_SMALL

Added in API level 5

Extra for ACTION_BATTERY_CHANGED : integer containing the resource ID of a small status bar icon indicating the current battery state.

Constant Value: "icon-small"

public static final String EXTRA_LEVEL

Added in API level 5

Extra for ACTION_BATTERY_CHANGED : integer field containing the current battery level, from 0 to EXTRA_SCALE .

Constant Value: "level"

public static final String EXTRA_PLUGGED

Added in API level 5

Extra for ACTION_BATTERY_CHANGED : integer indicating whether the device is plugged in to a power source; 0 means it is on battery, other constants are different types of power sources.

Constant Value: "plugged"

public static final String EXTRA_PRESENT

Added in API level 5

Extra for ACTION_BATTERY_CHANGED : boolean indicating whether a battery is present.

Constant Value: "present"

public static final String EXTRA_SCALE

Added in API level 5

Extra for ACTION_BATTERY_CHANGED : integer containing the maximum battery level.

Constant Value: "scale"

public static final String EXTRA_STATUS

Added in API level 5

Extra for ACTION_BATTERY_CHANGED : integer containing the current status constant.

Constant Value: "status"

public static final String EXTRA_TECHNOLOGY

Added in API level 5

Extra for ACTION_BATTERY_CHANGED : String describing the technology of the current battery.

Constant Value: "technology"

public static final String EXTRA_TEMPERATURE

Added in API level 5

Extra for ACTION_BATTERY_CHANGED : integer containing the current battery temperature.

Constant Value: "temperature"

public static final String EXTRA_VOLTAGE

Added in API level 5

Extra for ACTION_BATTERY_CHANGED : integer containing the current battery voltage level.

Constant Value: "voltage"

Public Constructors

public BatteryManager ()

Added in API level 1