BackgroundTaskBuilder Class


Represents a background task to register with the system.

public ref class BackgroundTaskBuilder sealed
class BackgroundTaskBuilder sealed
[Windows.Foundation.Metadata.Activatable(65536, typeof(Windows.Foundation.UniversalApiContract))]
[Windows.Foundation.Metadata.ContractVersion(typeof(Windows.Foundation.UniversalApiContract), 65536)]
public sealed class BackgroundTaskBuilder
[Windows.Foundation.Metadata.ContractVersion(typeof(Windows.Foundation.UniversalApiContract), 65536)]
[Windows.Foundation.Metadata.Activatable(65536, "Windows.Foundation.UniversalApiContract")]
public sealed class BackgroundTaskBuilder
function BackgroundTaskBuilder()
Public NotInheritable Class BackgroundTaskBuilder

Windows 10 requirements

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



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).

If your background task requires network connectivity, be aware of the following:

** Network related triggers**

  • Use a SocketActivityTrigger to activate the background task when a packet is received and you need to perform a short-lived task. After performing the task, the background task should terminate to save power.
  • Use a ControlChannelTrigger to activate the background task when a packet is received and you need to perform a long-lived task.

** Network related conditions and flags**

  • Add the InternetAvailable condition (BackgroundTaskBuilder.AddCondition ) to your background task to delay triggering the background task until the network stack is running. This condition saves power because the background task won't execute until network access is available. This condition does not provide real-time activation.

Regardless of the trigger you use, 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. If your background task does not use 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.)

Version history

Windows version SDK version Value added
1703 15063 TaskGroup



Creates an instance of the BackgroundTaskBuilder class.



Indicates whether the background task will be canceled if at least one of its required conditions is no longer met.


Indicates whether to keep the network up while running the background task.


Gets or sets the name of a background task.


Gets or sets the class that performs the work of a background task.


Gets and sets the group identifier.



Adds a condition to a background task.


Registers a background task with the system.


Assigns a COM CLSID entry point using an existing BackgroundTaskBuilder object.


Sets the event trigger for a background task.

Applies to