SystemConditionType SystemConditionType SystemConditionType SystemConditionType SystemConditionType Enum

Definition

Specifies a system condition that must be in effect for a background task to run. If a background task with a system condition is triggered, the task will not run until the condition is met.

public : enum class SystemConditionType
enum class winrt::Windows::ApplicationModel::Background::SystemConditionType : int32_t
public enum SystemConditionType
Public Enum SystemConditionType
var value = Windows.ApplicationModel.Background.SystemConditionType.backgroundWorkCostNotHigh;
Attributes

Windows 10 requirements

Device family
Windows 10 (introduced v10.0.10240.0)
API contract
Windows.Foundation.UniversalApiContract (introduced v1)

Fields

BackgroundWorkCostNotHigh BackgroundWorkCostNotHigh BackgroundWorkCostNotHigh BackgroundWorkCostNotHigh BackgroundWorkCostNotHigh 8

Specifies that the background task can only run when the cost to do background work is low.

FreeNetworkAvailable FreeNetworkAvailable FreeNetworkAvailable FreeNetworkAvailable FreeNetworkAvailable 7

Specifies that the background task can only run when a free (non-metered) network connection is available.

InternetAvailable InternetAvailable InternetAvailable InternetAvailable InternetAvailable 3

Specifies that the background task can only run when the Internet is available. If a background task with the InternetAvailable condition is triggered, and the Internet is not available, the task will not run until the Internet is available again. This condition saves power because the background task won't execute until the network is available. This condition does not provide real-time activation.

Important

Set IsNetworkRequested on your background task to ensure that the network stays up while the background task runs. This tells the background task infrastructure to keep the network up while the task is executing, even if the device has entered Connected Standby mode, so that you can call into the core networking APIs (HttpClient, StreamSocket, DatagramSocket, etc.) If your background task does not set IsNetworkRequested, then your background task will not be able to access the network when in Connected Standby mode (for example, when a phone's screen is turned off.)

InternetNotAvailable InternetNotAvailable InternetNotAvailable InternetNotAvailable InternetNotAvailable 4

Specifies that the background task can only run when the Internet is not available. If a background task with the InternetNotAvailable condition is triggered, and the Internet is available, the task will not run until the Internet is unavailable.

Invalid Invalid Invalid Invalid Invalid 0

Not a valid condition type.

SessionConnected SessionConnected SessionConnected SessionConnected SessionConnected 5

Specifies that the background task can only run when the user's session is connected. If a background task with the SessionConnected condition is triggered, and the user session is not logged in, the task will run when the user logs in.

SessionDisconnected SessionDisconnected SessionDisconnected SessionDisconnected SessionDisconnected 6

Specifies that the background task can only run when the user's session is disconnected. If a background task with the SessionDisconnected condition is triggered, and the user is logged in, the task will run when the user disconnects the remote desktop session or does fast user switching> [!NOTE]

SessionDisconnected is primarily used in the context of remote desktop and fast user switching. It is not meant to be used as a notification that the user has logged off of the machine.

UserNotPresent UserNotPresent UserNotPresent UserNotPresent UserNotPresent 2

Specifies that background task can only run when the user is not present. If a background task with the UserNotPresent condition is triggered, and the user is present, the task will not run until the user becomes inactive.

UserPresent UserPresent UserPresent UserPresent UserPresent 1

Specifies that the background task can only run when the user is present. If a background task with the UserPresent condition is triggered, and the user is away, the task will not run until the user is present.

See also

  • Windows.ApplicationModel.Background.BackgroundTaskBuilder P:Windows.ApplicationModel.Background.SystemCondition.ConditionType