Constants
The Battery API, which belongs to the kony.os Namespace, contains the following types of constants.
 Battery State Constants
Battery State Constants
                
                                                        These constants specify the current state of the device battery.
| Constant | Description | 
|---|---|
| BATTERY_STATE_CHARGING | Indicates that the state of the device battery as being charged. | 
| BATTERY_STATE_DISCHARGING | Indicates that the state of the device battery as being discharged. | 
| BATTERY_STATE_FULL | Indicates that the state of the device battery charge is completely full. | 
| BATTERY_STATE_UNKNOWN | Indicates that the state of the device battery charge as not known. | 
Example
When you query for the state of the device battery as shown in this example, any of the four available battery states is returned.
var batteryState = kony.os.getBatteryState();
if (kony.os.BATTERY_STATE_CHARGING == batteryState) {
    kony.print(“Battery State: Charging”);
}
                                                            Platform Availability
- iOS
- Android
