Documentation ¶
Overview ¶
Package battery provides functions to get the current status of the batteries.
That is useful to change app behavior based on the battery level. You can reduce animations or requests when the battery Level is low or if the user IsSaving battery.
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ( // ErrNotAvailableAPI indicates that the current device/OS doesn't support such function. ErrNotAvailableAPI = errors.New("pref: not available api") // ErrNoSystemBattery indicates that the current device doesn't use batteries. // // Some APIs (like Android and JS) don't provide a mechanism to determine whether the machine uses batteries or not. // In such a case ErrNoSystemBattery will never be returned. ErrNoSystemBattery = errors.New("pref: device isn't battery-powered") )
Functions ¶
func IsCharging ¶
IsCharging returns "true" if the device is charging. If the device doesn't rely on batteries it will be always true.
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.