Check battery saver state

[Some information relates to pre-released product which may be substantially modified before it's commercially released. Microsoft makes no warranties, express or implied, with respect to the information provided here.]

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.

Check if battery saver is on

Get notified when battery saver is turned on or off

Receiving push notifications when battery saver is on

When battery saver is on, push notifications are not received by your app. The exception to this is the Always allowed list. The Settings app (BATTERY SAVER SETTINGS) lets users select apps that are Always allowed to run in the background, even when battery saver is on. If your app uses notifications heavily, consider checking battery saver status and letting users know that your app will not receive notifications when battery saver is enabled if it's not added to the Always allowed list. For an example, see Windows Push Notification Services (WNS) overview.

The purpose of EnergySaverStatus is to indicate when to save energy. Even if your app is included in the Always allowed list, EnergySaverStatus will continue to reflect the status of battery saver.

 

 

Show: