danger.system
Class BatteryMonitor
java.lang.Object
danger.app.Listener
danger.system.BatteryMonitor
public class BatteryMonitor
- extends Listener
The purpose of this singleton class is to trigger certain actions
as a result of changes in the battery state.
Typical actions are to play warning sounds when the charge level
drops below a certain threshold, or to play notification sounds
when the charger is plugged in/unplugged.
| Methods inherited from class danger.app.Listener |
cancelEvents, childEventPump, childEventPumpDone, eventProblem, isDispatchingThread, receiveEvent, receiveEventInternal, sendEvent, sendEvent, sendEvent, sendEvent, sendEvent, sendLowPriorityEvent |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
isBatteryCharging
public static boolean isBatteryCharging()
isBatteryFull
public static boolean isBatteryFull()
isBatteryDischarging
public static boolean isBatteryDischarging()
isBatteryLow
public static boolean isBatteryLow()
getBatteryLevel
public static int getBatteryLevel()
- Get the approximate amount of battery life left.
- Returns:
- level between 0-1000