danger.system
Class BatteryMonitor

java.lang.Object
  extended by danger.app.Listener
      extended by 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.


Method Summary
static int getBatteryLevel()
          Get the approximate amount of battery life left.
static boolean isBatteryCharging()
           
static boolean isBatteryDischarging()
           
static boolean isBatteryFull()
           
static boolean isBatteryLow()
           
 
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
 

Method Detail

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