The Battery object provides device's battery information.


If a device support and not disabled battery information, you can use this object to obtain the current battery level and status. 

This feature is supported only on mobile devices. It is not supported on desktop.


Battery object has static methods:

Lib.Media.Sensors.Battery.getLevel()

Return battery level as percentage 


Lib.Media.Sensors.Battery.getStatus()

Return battery status

Can have values:

Lib.Media.Sensors.Battery.BATTERY_STATUS_UNKNOWN

Lib.Media.Sensors.Battery.BATTERY_STATUS_DISCHARGING

Lib.Media.Sensors.Battery.BATTERY_STATUS_CHARGING

Lib.Media.Sensors.Battery.BATTERY_STATUS_NOT_CHARGING

Lib.Media.Sensors.Battery.BATTERY_STATUS_FULL


Public battery constants:

Lib.Media.Sensors.Battery.BATTERY_STATUS_UNKNOWN

[static] unknown battery status

Lib.Media.Sensors.Battery.BATTERY_STATUS_DISCHARGING

[static] discharging (only on android)

Lib.Media.Sensors.Battery.BATTERY_STATUS_CHARGING

[static] charging

Lib.Media.Sensors.Battery.BATTERY_STATUS_NOT_CHARGING

[static] not charging

Lib.Media.Sensors.Battery.BATTERY_STATUS_FULL

[static] battery full

Created with the Personal Edition of HelpNDoc: Free help authoring tool