BackgroundTaskBuilder.Register | register method

Applies to Windows and Windows Phone

Registers a background task with the system.

Syntax


public BackgroundTaskRegistration Register()

Parameters

This method has no parameters.

Return value

Type: BackgroundTaskRegistration

An instance of a BackgroundTaskRegistration object.

Remarks

The task must have an event trigger and a task entry point for the Register method to succeed. The system schedules the background task when its trigger event occurs and all of its conditions have been met.

Background task parameter validation

Windows 8:  Windows 8 does not validate the parameters set on the BackgroundTaskBuilder object until the system tries to run the background task. If the parameters aren't valid, the background task can't start and an event log entry is created.

Windows 8.1:  Starting in Windows 8.1, the parameters used to register the background task are validated at the time of registration. An error is returned if the background task registration fails, allowing the app to determine whether or not the background task is valid.

Existing Windows 8 apps running on Windows 8.1 are subject to this new system behavior, which can cause the app to crash if it can't handle a failed background task registration. (An event log entry will still be generated for the failed background task registration.) As a result, Windows 8 apps that register invalid background tasks should be rewritten to register background tasks correctly and to handle failed background task registration.

Requirements

Minimum supported client

Windows 8

Minimum supported server

Windows Server 2012

Minimum supported phone

Windows Phone 8.1 [Windows Phone Silverlight 8.1 and Windows Runtime apps]

Namespace

Windows.ApplicationModel.Background
Windows::ApplicationModel::Background [C++]

Metadata

Windows.winmd

See also

BackgroundTaskBuilder

 

 

Show:
© 2014 Microsoft