BackgroundTaskRegistrationGroup BackgroundTaskRegistrationGroup BackgroundTaskRegistrationGroup BackgroundTaskRegistrationGroup Class

Definition

Provides grouping semantics so that background task registration can be maintained separately.

public : sealed class BackgroundTaskRegistrationGroup : IBackgroundTaskRegistrationGrouppublic sealed class BackgroundTaskRegistrationGroup : IBackgroundTaskRegistrationGroupPublic NotInheritable Class BackgroundTaskRegistrationGroup Implements IBackgroundTaskRegistrationGroup// You can use this class in JavaScript.
Attributes
Windows 10 requirements
Device family
Windows 10 Creators Update (introduced v10.0.15063.0)
API contract
Windows.Foundation.UniversalApiContract (introduced v4)

Examples

Background activation sample
Background task sample See scenario 6 for a grouped task example.

Remarks

Developers are encouraged to unregister, and then register, all background tasks used by the application when the app launches. However, in addition to unregistering the app's background tasks, this can also unregister background tasks registered by frameworks used by the app.

Grouped background task registration provides roughly the equivalent of a namespace for background tasks. You can register/unregister background tasks that belong to a group that you define without disturbing the registration of other background tasks on the device.

Constructors

BackgroundTaskRegistrationGroup(String) BackgroundTaskRegistrationGroup(String) BackgroundTaskRegistrationGroup(String) BackgroundTaskRegistrationGroup(String)

Creates a BackgroundTaskRegistrationGroup with the specified group ID.

public : BackgroundTaskRegistrationGroup(PlatForm::String id)public BackgroundTaskRegistrationGroup(String id)Public Sub New(id As String)// You can use this method in JavaScript.
Parameters
id
PlatForm::String String String String

The group ID.

Remarks

To reduce collisions with other group identifiers, consider including your domain name in the group identifier. For example: "com.contoso.appname.tasks". Or use the string form of a GUID.

BackgroundTaskRegistrationGroup(String, String) BackgroundTaskRegistrationGroup(String, String) BackgroundTaskRegistrationGroup(String, String) BackgroundTaskRegistrationGroup(String, String)

Creates a BackgroundTaskRegistrationGroup with the specified group ID and

public : BackgroundTaskRegistrationGroup(PlatForm::String id, PlatForm::String name)public BackgroundTaskRegistrationGroup(String id, String name)Public Sub New(id As String, name As String)// You can use this method in JavaScript.
Parameters
id
PlatForm::String String String String

The group ID.

name
PlatForm::String String String String

The friendly name for this group.

Remarks

To reduce collisions with other group identifiers, consider including your domain name in the group ID. For example: "com.contoso.appname.tasks". Or use the string form of a GUID.

The friendly name can be useful for debugging purposes if your group IDs are difficult to distinguish.

Properties

AllTasks AllTasks AllTasks AllTasks

Gets all of the background tasks that belong to the group.

public : IMapView<Guid, BackgroundTaskRegistration> AllTasks { get; }public IReadOnlyDictionary<Guid, BackgroundTaskRegistration> AllTasks { get; }Public ReadOnly Property AllTasks As IReadOnlyDictionary<Guid, BackgroundTaskRegistration>// You can use this property in JavaScript.
Value
IMapView<PlatForm::Guid, BackgroundTaskRegistration> IReadOnlyDictionary<Guid, BackgroundTaskRegistration> IReadOnlyDictionary<Guid, BackgroundTaskRegistration> IReadOnlyDictionary<Guid, BackgroundTaskRegistration>

The background tasks that belong to the group.

Remarks

Null is returned if no tasks belong to the group.

See Also

Id Id Id Id

Gets the group ID.

public : PlatForm::String Id { get; }public string Id { get; }Public ReadOnly Property Id As string// You can use this property in JavaScript.
Value
PlatForm::String string string string

The group ID.

Name Name Name Name

Gets the friendly name of the group.

public : PlatForm::String Name { get; }public string Name { get; }Public ReadOnly Property Name As string// You can use this property in JavaScript.
Value
PlatForm::String string string string

The friendly name.

Events

BackgroundActivated BackgroundActivated BackgroundActivated BackgroundActivated

This event is fired when a background task that belongs to a group starts.

public : event TypedEventHandler BackgroundActivated<BackgroundTaskRegistrationGroup,  BackgroundActivatedEventArgs>public event TypedEventHandler BackgroundActivated<BackgroundTaskRegistrationGroup,  BackgroundActivatedEventArgs>Public Event BackgroundActivated<BackgroundTaskRegistrationGroup,  BackgroundActivatedEventArgs>// You can use this event in JavaScript.

Examples

Background activation sample See scenario 6 for a grouped task example.

Remarks

Background triggers associated with a group fire this event instead of having a task entry point. For single-process background tasks that don't define an entry point in their background task registration, this event is the entry point. Instead of calling the application's OnBackgroundActivated method, the event attached to the group is called.

See Also