Android Guides | Samples

Android.OS.BatteryManager Class

The BatteryManager class contains strings and constants used for values in the Intent.ActionBatteryChanged Intent, and provides a method for querying battery and charging properties.

See Also: BatteryManager

Syntax

[Android.Runtime.Register("android/os/BatteryManager", DoNotGenerateAcw=true)]
public class BatteryManager : Object

Remarks

The BatteryManager class contains strings and constants used for values in the Intent.ActionBatteryChanged Intent, and provides a method for querying battery and charging properties.

[Android Documentation]

Requirements

Namespace: Android.OS
Assembly: Mono.Android (in Mono.Android.dll)
Assembly Versions: 0.0.0.0
Since: Added in API level 1

The members of Android.OS.BatteryManager are listed below.

See Also: Object

Public Constructors

Protected Constructors

A constructor used when creating managed representations of JNI objects; called by the runtime.

Public Fields

const
BatteryHealthColdBatteryHealth (7).
const
BatteryHealthDeadBatteryHealth (4).
const
BatteryHealthGoodBatteryHealth (2).
const
BatteryHealthOverheatBatteryHealth (3).
const
BatteryHealthOverVoltageBatteryHealth (5).
const
BatteryHealthUnknownBatteryHealth (1).
const
BatteryHealthUnspecifiedFailureBatteryHealth (6).
const
BatteryPluggedAcBatteryPlugged (1). Power source is an AC charger.
const
BatteryPluggedUsbBatteryPlugged (2). Power source is a USB port.
const
BatteryPluggedWirelessBatteryPlugged (4). Power source is wireless.
const
BatteryPropertyCapacityBatteryProperty (4). Remaining battery capacity as an integer percentage of total capacity (with no fractional part).
const
BatteryPropertyChargeCounterBatteryProperty (1). Battery capacity in microampere-hours, as an integer.
const
BatteryPropertyCurrentAverageBatteryProperty (3). Average battery current in microamperes, as an integer.
const
BatteryPropertyCurrentNowBatteryProperty (2). Instantaneous battery current in microamperes, as an integer.
const
BatteryPropertyEnergyCounterBatteryProperty (5). Battery remaining energy in nanowatt-hours, as a long integer.
const
BatteryStatusChargingBatteryStatus (2).
const
BatteryStatusDischargingBatteryStatus (3).
const
BatteryStatusFullBatteryStatus (5).
const
BatteryStatusNotChargingBatteryStatus (4).
const
BatteryStatusUnknownBatteryStatus (1).
const
ExtraHealthString. Extra for Intent.ActionBatteryChanged: integer containing the current health constant.
const
ExtraIconSmallString. Extra for Intent.ActionBatteryChanged: integer containing the resource ID of a small status bar icon indicating the current battery state.
const
ExtraLevelString. Extra for Intent.ActionBatteryChanged: integer field containing the current battery level, from 0 to BatteryManager.ExtraScale.
const
ExtraPluggedString. Extra for Intent.ActionBatteryChanged: 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.
const
ExtraPresentString. Extra for Intent.ActionBatteryChanged: boolean indicating whether a battery is present.
const
ExtraScaleString. Extra for Intent.ActionBatteryChanged: integer containing the maximum battery level.
const
ExtraStatusString. Extra for Intent.ActionBatteryChanged: integer containing the current status constant.
const
ExtraTechnologyString. Extra for Intent.ActionBatteryChanged: String describing the technology of the current battery.
const
ExtraTemperatureString. Extra for Intent.ActionBatteryChanged: integer containing the current battery temperature.
const
ExtraVoltageString. Extra for Intent.ActionBatteryChanged: integer containing the current battery voltage level.

Protected Properties

[read-only]
override
ThresholdClassIntPtr. This API supports the Mono for Android infrastructure and is not intended to be used directly from your code.
[read-only]
override
ThresholdTypeType. This API supports the Mono for Android infrastructure and is not intended to be used directly from your code.

Public Methods

GetIntProperty(Int32) : Int32
Return the value of a battery property of integer type.
GetLongProperty(Int32) : Int64
Return the value of a battery property of long type If the platform does not provide the property queried, this value will be Long.