SystemCondition SystemCondition SystemCondition SystemCondition SystemCondition Class


Represents a system condition that must be in effect for a background task to run.

public : sealed class SystemCondition : IBackgroundCondition, ISystemCondition
struct winrt::Windows::ApplicationModel::Background::SystemCondition : IBackgroundCondition, ISystemCondition
public sealed class SystemCondition : IBackgroundCondition, ISystemCondition
Public NotInheritable Class SystemCondition Implements IBackgroundCondition, ISystemCondition
var systemCondition = new systemCondition(conditionType);
Windows 10 requirements
Device family
Windows 10 (introduced v10.0.10240.0)
API contract
Windows.Foundation.UniversalApiContract (introduced v1)


The following example expands on the example shown in SystemTrigger by also adding a condition to the background task.

// A friendly task name.
String name = "ExampleTaskName";

// Must be the same entry point that is specified in the manifest.
String taskEntryPoint = "ExampleNamespace.ExampleTaskName";

// A system trigger that goes off whenever the time zone is changed, or a change occurs with daylight savings time.
IBackgroundTrigger trigger = IBackgroundTrigger trigger = new SystemTrigger(SystemTriggerType.TimeZoneChange, false);

// A system condition indicating that the background task shouldn't run until the user is present.
SystemCondition condition = new SystemCondition(SystemConditionType.UserPresent)

// Builds the background task.
BackgroundTaskBuilder builder = new BackgroundTaskBuilder();

builder.Name = name;
builder.TaskEntryPoint = taskEntryPoint;

// Registers the background task, and get back a BackgroundTaskRegistration object representing the registered task.
BackgroundTaskRegistration task = builder.Register();



: This class is not agile, which means that you need to consider its threading model and marshaling behavior. For more info, see Threading and Marshaling (C++/CX) and Using Windows Runtime objects in a multithreaded environment (.NET).


SystemCondition(SystemConditionType) SystemCondition(SystemConditionType) SystemCondition(SystemConditionType) SystemCondition(SystemConditionType) SystemCondition(SystemConditionType)

Initializes a new instance of a system condition.


ConditionType ConditionType ConditionType ConditionType ConditionType

Gets the condition type of a system condition.