Windows.​Application​Model.​Background Windows.​Application​Model.​Background Windows.​Application​Model.​Background Namespace

Enables an app to schedule background tasks to run app code even when the app is suspended.

Background tasks are intended for small work items that do not require user interaction. Scenarios that are appropriate for background tasks include downloading mail, showing a toast notification for an incoming chat message, or reacting to a change in a system condition.

See Supporting your app with background tasks ( using JavaScript and HTML) or Support your app with background tasks for guidance on implementing background tasks. For a general overview of background tasks in Windows Store app, see the Introduction to Background Tasks whitepaper. For example code that shows how to implement background tasks, see the Background Task Sample.

Classes

ActivitySensorTrigger ActivitySensorTrigger ActivitySensorTrigger

Represents a trigger that is activated when the ActivitySensor receives input. This is used when your application needs to respond to the activity sensor.

AlarmApplicationManager AlarmApplicationManager AlarmApplicationManager

Requests permission from the user to set alarms, and retrieves the status of user permission for the app to set alarms.

AppBroadcastTrigger AppBroadcastTrigger AppBroadcastTrigger

Represents an event that triggers a background task to run when an application starts gameplay broadcasting.

AppBroadcastTriggerProviderInfo AppBroadcastTriggerProviderInfo AppBroadcastTriggerProviderInfo

Provides information about the application that is broadcasting gameplay such as its logo, display name, and video characteristics.

ApplicationTrigger ApplicationTrigger ApplicationTrigger

This allows you to programmatically trigger a background tasks from within your application.

ApplicationTriggerDetails ApplicationTriggerDetails ApplicationTriggerDetails

The details of an ApplicationTrigger.

AppointmentStoreNotificationTrigger AppointmentStoreNotificationTrigger AppointmentStoreNotificationTrigger

Represents a trigger that launches a background task for processing changes to the appointment store.

BackgroundExecutionManager BackgroundExecutionManager BackgroundExecutionManager

Manage permission to run background tasks.

BackgroundTaskBuilder BackgroundTaskBuilder BackgroundTaskBuilder

Represents a background task to be registered with the system.

Note

Starting in Windows 8.1, the parameters used to register the background task are validated at the time the task is registered. See the remarks for BackgroundTaskBuilder.Register.

BackgroundTaskCompletedEventArgs BackgroundTaskCompletedEventArgs BackgroundTaskCompletedEventArgs

Represents completion information for a task at the time a completion notification is sent.

BackgroundTaskDeferral BackgroundTaskDeferral BackgroundTaskDeferral

Represents a background task deferral returned by the IBackgroundTaskInstance.GetDeferral method.

BackgroundTaskProgressEventArgs BackgroundTaskProgressEventArgs BackgroundTaskProgressEventArgs

Represents progress information for a task at the time a progress update notification is sent.

BackgroundTaskRegistration BackgroundTaskRegistration BackgroundTaskRegistration

Represents a background task that has been registered with the system.

BackgroundTaskRegistrationGroup BackgroundTaskRegistrationGroup BackgroundTaskRegistrationGroup

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

BackgroundWorkCost BackgroundWorkCost BackgroundWorkCost

Retrieves a hint about resource availability for background tasks. Background tasks can use this hint to decide how much work to do when they are activated.

BluetoothLEAdvertisementPublisherTrigger BluetoothLEAdvertisementPublisherTrigger BluetoothLEAdvertisementPublisherTrigger

Represents a trigger that is registered to advertise a Bluetooth LE advertisement in the background.

BluetoothLEAdvertisementWatcherTrigger BluetoothLEAdvertisementWatcherTrigger BluetoothLEAdvertisementWatcherTrigger

Represents a trigger that is registered to scan for Bluetooth LE advertisement in the background.

CachedFileUpdaterTrigger CachedFileUpdaterTrigger CachedFileUpdaterTrigger

Represents a trigger that launches a background task to enable the Cached File Updater contract.

CachedFileUpdaterTriggerDetails CachedFileUpdaterTriggerDetails CachedFileUpdaterTriggerDetails

Provides details about the cached file operation that invoked the trigger.

ChatMessageNotificationTrigger ChatMessageNotificationTrigger ChatMessageNotificationTrigger

Represents a trigger that is activated when there is a notification for a text message.

ChatMessageReceivedNotificationTrigger ChatMessageReceivedNotificationTrigger ChatMessageReceivedNotificationTrigger

Represents a trigger that launches a background task that handles any incoming message that might need to be filtered according to its content. For more information about filtering messages, see Windows.ApplicationModel.CommunicationBlocking.

CommunicationBlockingAppSetAsActiveTrigger CommunicationBlockingAppSetAsActiveTrigger CommunicationBlockingAppSetAsActiveTrigger

Represents a trigger to activate a communication blocking application when it is selected as the preferred blocking app.

A user can have multiple communication blocking applications installed at one time. This trigger is used to let an application know that it has been selected as the active communication blocking application. For more information about the communication blocking API, see Windows.ApplicationModel.CommunicationBlocking.

ContactStoreNotificationTrigger ContactStoreNotificationTrigger ContactStoreNotificationTrigger

Represents a trigger that launches a background task for processing changes to the contacts store.

ContentPrefetchTrigger ContentPrefetchTrigger ContentPrefetchTrigger

Provides the ability to run custom handlers when prefetching web resources.

DeviceConnectionChangeTrigger DeviceConnectionChangeTrigger DeviceConnectionChangeTrigger

Represents a trigger that launches a background task when the connection status of a device changes.

DeviceManufacturerNotificationTrigger DeviceManufacturerNotificationTrigger DeviceManufacturerNotificationTrigger

Represents a trigger that launches a background task to enable device manufacturer operations.

DeviceServicingTrigger DeviceServicingTrigger DeviceServicingTrigger

Represents an event that an application can trigger to initiate a long-running update (firmware or settings) of a device.

Windows 8.1 enables you to develop Windows Store app for your peripheral devices that communicate over USB, HID, and Bluetooth. For example, a user might need to sync content on a PC to or from the device, or perform a long-running update to the device itself like settings or firmware updates. Windows 8.1 provides two background tasks and corresponding APIs that allow your device to sync and update in the background: DeviceServicingTrigger and DeviceUseTrigger. This topic provides API reference information for DeviceServicingTrigger - for info on using this trigger in the context of a device app, see Device sync and update for Windows Store device apps.

The DeviceServicingTrigger background task allows your Windows Store app that interacts with your peripheral device to perform long running device updates while your app is suspended, for example settings transfers or firmware updates. Updating your device in the background requires user approval each time the background task is used. Unlike the DeviceUseTrigger background task, the DeviceServicingTrigger background task allows for device reboot and disconnect and allows a maximum of 30 minutes of background activity.

DeviceUseTrigger DeviceUseTrigger DeviceUseTrigger

Represents an event that a Windows Runtime app can trigger to initiate a long-running operation with a device or sensor.

DeviceUseTrigger lets your Windows Runtime app access sensors and peripheral devices in the background, even when your foreground app is suspended. For example, depending on where your app is running, it could use a background task to synchronize data with devices or monitor sensors.

This class can be used in Windows Store app and Windows Phone Store app. However, a DeviceUseTrigger background task supports different APIs, and is subject to different policies, depending where it's running (PC or phone). To learn more about these differences, see Accessing sensors and devices from a background task.

Important

This trigger cannot be used with single-process background tasks.

For a sample that shows how to use DeviceUseTrigger on a PC, see the Custom USB device sample. For a phone sample, see the Background Sensors sample.

DeviceWatcherTrigger DeviceWatcherTrigger DeviceWatcherTrigger

Represents an event that causes a background task to run when changes occur to the list of devices. Returned by GetBackgroundTrigger.

EmailStoreNotificationTrigger EmailStoreNotificationTrigger EmailStoreNotificationTrigger

Represents a trigger that enables notification of changes to the email store.

GattCharacteristicNotificationTrigger GattCharacteristicNotificationTrigger GattCharacteristicNotificationTrigger

Represents a trigger that launches a background task when an incoming change notification is received for a Bluetooth LE GATT characteristic.

GattServiceProviderTrigger GattServiceProviderTrigger GattServiceProviderTrigger

Constructs a Generic Attributes (GATT) service that can be persisted in the background.

GattServiceProviderTriggerResult GattServiceProviderTriggerResult GattServiceProviderTriggerResult

This class contains the trigger created by GattServiceProviderTrigger.CreateAsync().

LocationTrigger LocationTrigger LocationTrigger

Represents a location event that triggers a background task. This is used for Geofencing.

MaintenanceTrigger MaintenanceTrigger MaintenanceTrigger

Represents a maintenance trigger.

MediaProcessingTrigger MediaProcessingTrigger MediaProcessingTrigger

Represents a trigger that launches a background task for performing media processing.

MobileBroadbandDeviceServiceNotificationTrigger MobileBroadbandDeviceServiceNotificationTrigger MobileBroadbandDeviceServiceNotificationTrigger

Represents a trigger that activates when the network sends SIM tool commands. Apps receiving this notification then process the SIM tool commands.

This functionality is only available to mobile operator apps and Windows Store app given privileged access by mobile network operators. For more information, see Mobile Broadband: .

MobileBroadbandPinLockStateChangeTrigger MobileBroadbandPinLockStateChangeTrigger MobileBroadbandPinLockStateChangeTrigger

Represents a trigger that indicates when the SIM PIN lock state has changed.

This functionality is only available to mobile operator apps and Windows Store app given privileged access by mobile network operators. For more information, see Mobile Broadband: .

MobileBroadbandRadioStateChangeTrigger MobileBroadbandRadioStateChangeTrigger MobileBroadbandRadioStateChangeTrigger

Represents a trigger that indicates when mobile broadband radio state has changed. For example, this trigger activates when a mobile device transitions to or from airplane mode.

This functionality is only available to mobile operator apps and Windows Store app given privileged access by mobile network operators. For more information, see Mobile Broadband: .

MobileBroadbandRegistrationStateChangeTrigger MobileBroadbandRegistrationStateChangeTrigger MobileBroadbandRegistrationStateChangeTrigger

Represents a trigger that indicates when mobile broadband registration state has changed. For example, this trigger activates when a mobile device transitions to or from Roaming.

This functionality is only available to mobile operator apps and Windows Store app given privileged access by mobile network operators. For more information, see Mobile Broadband: .

NetworkOperatorHotspotAuthenticationTrigger NetworkOperatorHotspotAuthenticationTrigger NetworkOperatorHotspotAuthenticationTrigger

Represents a mobile network operator hotspot authentication trigger.

Note

An app can only instantiate this object and register for the hotspot authentication event after a WLAN profile has been provisioned that references this app to handle hotspot authentication. For more info, see Windows 8 Integration for Wireless Hotspot Operators.

NetworkOperatorNotificationTrigger NetworkOperatorNotificationTrigger NetworkOperatorNotificationTrigger

Represents a mobile network operator notification trigger.

PhoneTrigger PhoneTrigger PhoneTrigger

Represents a phone event that triggers a background task.

PushNotificationTrigger PushNotificationTrigger PushNotificationTrigger

Represents an object that invokes a background work item on the app in response to the receipt of a raw notification.

RcsEndUserMessageAvailableTrigger RcsEndUserMessageAvailableTrigger RcsEndUserMessageAvailableTrigger

Represents a trigger that launches a background task when a new Rich Communication Services (RCS) message is available.

RfcommConnectionTrigger RfcommConnectionTrigger RfcommConnectionTrigger

Represents a trigger that launches a background task when an RFCOMM inbound or outbound connections are established.

SecondaryAuthenticationFactorAuthenticationTrigger SecondaryAuthenticationFactorAuthenticationTrigger SecondaryAuthenticationFactorAuthenticationTrigger

Represents a trigger that launches a background task on behalf of a companion device.

SensorDataThresholdTrigger SensorDataThresholdTrigger SensorDataThresholdTrigger

Represents a trigger that responds when a threshold limit for a sensor is crossed.

SmartCardTrigger SmartCardTrigger SmartCardTrigger

Represents an event triggered by a smart card.

SmsMessageReceivedTrigger SmsMessageReceivedTrigger SmsMessageReceivedTrigger

Represents a trigger that is raised when an SMS message has arrived.

SocketActivityTrigger SocketActivityTrigger SocketActivityTrigger

Represents a trigger that launches a background task for handling socket activity.

StorageLibraryContentChangedTrigger StorageLibraryContentChangedTrigger StorageLibraryContentChangedTrigger

Creates a trigger that will fire when a file is changed in a specified library.

SystemCondition SystemCondition SystemCondition

Represents a system condition that must be in effect for a background task to run.

SystemTrigger SystemTrigger SystemTrigger

Represents a system event that triggers a background task to run.

TimeTrigger TimeTrigger TimeTrigger

Represents a time event that triggers a background task to run.

ToastNotificationActionTrigger ToastNotificationActionTrigger ToastNotificationActionTrigger

Represents an event that causes a background task to run when the user performs an action on an interactive toast notification.

ToastNotificationHistoryChangedTrigger ToastNotificationHistoryChangedTrigger ToastNotificationHistoryChangedTrigger

Represents an event that causes a background task to run when the history of toast notifications for the app is cleared, when one or more toast notifications are added to or removed from the notification history for the app, or when one or more toast notifications for the app expire and are removed from the notification history.

UserNotificationChangedTrigger UserNotificationChangedTrigger UserNotificationChangedTrigger

Represents a trigger that fires when a UserNotification is added or removed.

Interfaces

IBackgroundCondition IBackgroundCondition IBackgroundCondition

Used to enforce the system condition object type.

IBackgroundTask IBackgroundTask IBackgroundTask

Provides a method to perform the work of a background task.

IBackgroundTaskInstance IBackgroundTaskInstance IBackgroundTaskInstance

Provides access to a background task instance.

IBackgroundTaskInstance2 IBackgroundTaskInstance2 IBackgroundTaskInstance2

Provides access to a background task instance. Inherits from the IBackgroundTaskInstance interface and adds the GetThrottleCount method.

IBackgroundTaskInstance4 IBackgroundTaskInstance4 IBackgroundTaskInstance4

Provides access to a background task instance including information about the user.

IBackgroundTaskRegistration IBackgroundTaskRegistration IBackgroundTaskRegistration

Provides access to a registered background task.

IBackgroundTaskRegistration2 IBackgroundTaskRegistration2 IBackgroundTaskRegistration2

Provides access to a registered background task. Inherits from the IBackgroundTaskRegistration interface and adds the Trigger property.

IBackgroundTaskRegistration3 IBackgroundTaskRegistration3 IBackgroundTaskRegistration3

Represents a background task that has been registered as part of a group of related background tasks.

IBackgroundTrigger IBackgroundTrigger IBackgroundTrigger

Represents the base interface for trigger events.

Enums

AlarmAccessStatus AlarmAccessStatus AlarmAccessStatus

Indicates whether the user has given permission for the app to set alarms.

ApplicationTriggerResult ApplicationTriggerResult ApplicationTriggerResult

The result of the request to trigger a background task. The RequestAsync method returns a value of this enumeration type.

BackgroundAccessStatus BackgroundAccessStatus BackgroundAccessStatus

This enumeration specifies an app's ability to perform background activity.

Apps must successfully call Windows.ApplicationModel.Background.BackgroundExecutionManager.requestAccessAsync before registering background tasks.

BackgroundTaskCancellationReason BackgroundTaskCancellationReason BackgroundTaskCancellationReason

Specifies the reasons for cancelling a background task.

BackgroundTaskThrottleCounter BackgroundTaskThrottleCounter BackgroundTaskThrottleCounter

Indicates the type of throttle count to check for in a GetThrottleCount request.

BackgroundWorkCostValue BackgroundWorkCostValue BackgroundWorkCostValue

Indicates the current cost of doing background work. Used as a hint to background tasks about how much work they can do.

DeviceTriggerResult DeviceTriggerResult DeviceTriggerResult

Indicates whether the device background task operation was allowed or denied, and if it was denied specifies the reason.

LocationTriggerType LocationTriggerType LocationTriggerType

Indicates a type of location event for a location background task trigger.

MediaProcessingTriggerResult MediaProcessingTriggerResult MediaProcessingTriggerResult

Specifies the result of a call to MediaProcessingTrigger::RequestAsync.

SystemConditionType SystemConditionType SystemConditionType

Specifies a system condition that must be in effect for a background task to run. If a background task with a system condition is triggered, the task will not run until the condition is met.

SystemTriggerType SystemTriggerType SystemTriggerType

Specifies the system events that can be used to trigger a background task.

Delegates

BackgroundTaskCanceledEventHandler BackgroundTaskCanceledEventHandler BackgroundTaskCanceledEventHandler

Represents a method that handles the cancellation of a background task.

BackgroundTaskCompletedEventHandler BackgroundTaskCompletedEventHandler BackgroundTaskCompletedEventHandler

Represents a method that handles completion events for a background task.

BackgroundTaskProgressEventHandler BackgroundTaskProgressEventHandler BackgroundTaskProgressEventHandler

Represents a method that handles progress update events for a background task.