1. To obtain the battery information of the Android device, register a BroadCastReceiver whose Action is Intent. ACTION_BATTERY_CHANGED.
2. In the BroadcastReceiver onReceive () event, the received Intent. ACTION_BATTERY_CHANGED includes the following information:
"Present" (boolean )...
"Level" (int )... Remaining battery capacity
"Scale" (int )... Maximum battery value, usually 100.
"Icon-small" (int )... Icon ID.
"Voltage" (int )... Battery voltage (volt)
"Temperature" (int )... The temperature of the battery, measured in 0.1 degrees. For example, 197 indicates 19.7 degrees.
"Technology" (String )... Battery type, such as Li-ion.
"Plugged" (int )... Charging method:
BatteryManager. BATTERY_PLUGGED_AC: AC is charged.
BatteryManager. BATTERY_PLUGGED_USB: USB charging.
"Status" (int )... Battery status:
BatteryManager. BATTERY_STATUS_CHARGING: the charging status.
BatteryManager. BATTERY_STATUS_DISCHARGING: discharge status.
BatteryManager. BATTERY_STATUS_NOT_CHARGING: not full.
BatteryManager. BATTERY_STATUS_FULL: fully charged.
BatteryManager. BATTERY_STATUS_UNKNOWN: Unknown Status.
"Health" (int )... Health status:
BatteryManager. BATTERY_HEALTH_GOOD: The status is good.
BatteryManager. BATTERY_HEALTH_DEAD: the battery has no power.
BatteryManager. BATTERY_HEALTH_OVER_VOLTAGE: the battery voltage is too high.
BatteryManager. BATTERY_HEALTH_OVERHEAT: The BatteryManager is overheated.
BatteryManager. BATTERY_HEALTH_UNKNOWN: Unknown Status.
BatteryActivity batteryReceiver = BatteryReceiver level = arg1.getIntExtra ("level", 0 "Battery", "remaining Battery power:" + level + "%"