Share via


BackgroundTaskBuilder Class

Definition

Represents a background task to register with the system.

public ref class BackgroundTaskBuilder sealed
/// [Windows.Foundation.Metadata.Activatable(65536, "Microsoft.Windows.ApplicationModel.Background.BackgroundTaskContract")]
/// [Windows.Foundation.Metadata.ContractVersion(Microsoft.Windows.ApplicationModel.Background.BackgroundTaskContract, 65536)]
/// [Windows.Foundation.Metadata.MarshalingBehavior(Windows.Foundation.Metadata.MarshalingType.Agile)]
/// [Windows.Foundation.Metadata.Threading(Windows.Foundation.Metadata.ThreadingModel.Both)]
class BackgroundTaskBuilder final
[Windows.Foundation.Metadata.Activatable(65536, "Microsoft.Windows.ApplicationModel.Background.BackgroundTaskContract")]
[Windows.Foundation.Metadata.ContractVersion(typeof(Microsoft.Windows.ApplicationModel.Background.BackgroundTaskContract), 65536)]
[Windows.Foundation.Metadata.MarshalingBehavior(Windows.Foundation.Metadata.MarshalingType.Agile)]
[Windows.Foundation.Metadata.Threading(Windows.Foundation.Metadata.ThreadingModel.Both)]
public sealed class BackgroundTaskBuilder
function BackgroundTaskBuilder()
Public NotInheritable Class BackgroundTaskBuilder
Inheritance
Object Platform::Object IInspectable BackgroundTaskBuilder
Attributes

Remarks

For information on migrating UWP apps with background tasks to WinUI 3, see the Windows App SDK Background task migration strategy guide.

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

Constructors

BackgroundTaskBuilder()

Create a new BackgroundTaskBuilder object.

Properties

Name

Gets or sets the name of a background task.

TaskGroup

Gets and sets the group identifier so a background task registration can be maintained separately.

Methods

AddCondition(IBackgroundCondition)

Adds a condition to a background task.

Register()

Registers a background task with the system.

Register(String)

Registers a background task with the system.

SetTaskEntryPointClsid(Guid)

Assigns a COM CLSID entry point for the background task using an existing BackgroundTaskBuilder object.

SetTrigger(IBackgroundTrigger)

Sets the event trigger for a background task.

Applies to

See also