Dela via


BackgroundTaskBuilder.TaskEntryPoint Property

Definition

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

public:
 property Platform::String ^ TaskEntryPoint { Platform::String ^ get(); void set(Platform::String ^ value); };
winrt::hstring TaskEntryPoint();

void TaskEntryPoint(winrt::hstring value);
public string TaskEntryPoint { get; set; }
var string = backgroundTaskBuilder.taskEntryPoint;
backgroundTaskBuilder.taskEntryPoint = string;
Public Property TaskEntryPoint As String

Property Value

String

Platform::String

winrt::hstring

The name of an application-defined class that performs the work of a background task.

Remarks

UWP app using C++, C#, or Visual Basic The task entry point class must implement the IBackgroundTask interface. The system calls IBackgroundTask::Run when the background task is triggered. In addition, the class must be specified in the <Extensions> section of the application's manifest as <Extension Category="windows.backgroundTasks" EntryPoint="appNamespace.appClassName">.The task entry point class can be implemented in the same process as the application's foreground component (in-proc); however, it cannot run on any of the application's foreground threads because the application might be suspended when the background task is triggered. For best results, implement the class in a separate process (out-of-proc) to decouple it from the application's foreground components and allow the system to manage the application's processes more efficiently.

UWP app using JavaScript The entry point for a JavaScript background task is a JavaScript start page. See WebUIBackgroundTaskInstance.current for more information.Note that JavaScript background tasks must call close() to terminate when they are done, so they don't continue to consume the user's memory and battery.

Applies to