Dela via


EnergySaverStatus Enum

Definition

Specifies the status of battery saver.

public enum class EnergySaverStatus
/// [Windows.Foundation.Metadata.ContractVersion(Windows.Foundation.UniversalApiContract, 65536)]
enum class EnergySaverStatus
[Windows.Foundation.Metadata.ContractVersion(typeof(Windows.Foundation.UniversalApiContract), 65536)]
public enum EnergySaverStatus
var value = Windows.System.Power.EnergySaverStatus.disabled
Public Enum EnergySaverStatus
Inheritance
EnergySaverStatus
Attributes

Windows requirements

Device family
Windows 10 (introduced in 10.0.10240.0)
API contract
Windows.Foundation.UniversalApiContract (introduced in v1.0)

Fields

Name Value Description
Disabled 0

Battery saver is off permanently or the device is plugged in.

Off 1

Battery saver is off now, but ready to turn on automatically.

On 2

Battery saver is on. Save energy where possible.

Remarks

A user can turn on battery saver at any time to save energy (as long as the device is running on battery power). Battery saver extends battery life by limiting background activity on the device. In addition to the efforts of battery saver, your app can do its own part to save energy. Before initiating resource intensive tasks, check EnergySaverStatus to make sure battery saver isn’t on. If your app’s resource intensive tasks are long-running, listen for the EnergySaverStatusChanged event so that those tasks can be stopped when battery saver is turned on.

A user can also set battery saver to turn on automatically when the battery reaches a specified charge threshold, such as 20% remaining. When it's in this state (before it turns on automatically), EnergySaverStatus is Off. If the user disables this automatic setting, EnergySaverStatus is Disabled.

Even if the automatic setting is enabled, when the device is plugged in, battery saver is turned off and EnergySaverStatus is Disabled. It is not Off because as long as the device is plugged in, battery saver cannot be turned on.

When battery saver is on, the receipt of push notifications is disabled to save energy. But there are a couple exceptions to this. Battery saver settings (from the Settings app) provides settings that allow your app to receive push notifications even when battery saver is on. If your app depends heavily on push notifications, we recommend notifying users that they may not receive notifications while battery saver is on and to make it easy for them to adjust battery saver settings. For more info and examples, see Windows Push Notification Services (WNS) overview.

Applies to