Class: Battery¶
domain/Battery.Battery
Constructors¶
constructor¶
new Battery(health?
, plugged?
, status?
, capacity?
)
Class representing the device’s battery health, status and plugged state. See https://developer.android.com/reference/android/os/BatteryManager for more information.
Parameters¶
Name |
Type |
Description |
---|---|---|
|
the battery’s health (either UNKNOWN, GOOD, OVERHEAT, DEAD, OVER_VOLTAGE, UNSPECIFIED_FAILURE, COLD) |
|
|
the battery’s plugged status (either DOCK, AC, USB, WIRELESS) |
|
|
the battery’s status (either UNKNOWN, CHARGING, DISCHARGING, NOT_CHARGING, FULL) |
|
|
|
Remaining battery capacity as an integer percentage of total capacity (with no fractional part). |
Properties¶
capacity¶
Optional
capacity: number
Remaining battery capacity as an integer percentage of total capacity (with no fractional part).
health¶
Optional
health: BatteryHealth
the battery’s health (either UNKNOWN, GOOD, OVERHEAT, DEAD, OVER_VOLTAGE, UNSPECIFIED_FAILURE, COLD)
plugged¶
Optional
plugged: BatteryPlugged
the battery’s plugged status (either DOCK, AC, USB, WIRELESS)
status¶
Optional
status: BatteryStatus
the battery’s status (either UNKNOWN, CHARGING, DISCHARGING, NOT_CHARGING, FULL)
Methods¶
fromJSON¶
Static
fromJSON(battery
): Battery
Create from JSON
Parameters¶
Name |
Type |
Description |
---|---|---|
|
|
JSON object |