Windows.ApplicationModel.Background Namespace
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
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 or for handling toast actions. 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 example code that shows how to implement background tasks, see the Background Task Sample.
Classes
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 |
Requests permission from the user to set alarms, and retrieves the status of user permission for the app to set alarms. |
AppBroadcastTrigger |
Represents an event that triggers a background task to run when an application starts gameplay broadcasting. |
AppBroadcastTriggerProviderInfo |
Provides information about the application that is broadcasting gameplay such as its logo, display name, and video characteristics. |
ApplicationTrigger |
This is used by the BackgroundTaskBuilder to programmatically trigger a background task from within your application. |
ApplicationTriggerDetails |
The details of an ApplicationTrigger. |
AppointmentStoreNotificationTrigger |
Represents a trigger that launches a background task for processing changes to the appointment store. |
BackgroundExecutionManager |
Manage permission to run background tasks. |
BackgroundTaskBuilder |
Represents a background task to register with the system. |
BackgroundTaskCompletedEventArgs |
Represents completion information for a task at the time a completion notification is sent. |
BackgroundTaskDeferral |
Represents a background task deferral returned by the IBackgroundTaskInstance.GetDeferral method. |
BackgroundTaskProgressEventArgs |
Represents progress information for a task at the time a progress update notification is sent. |
BackgroundTaskRegistration |
Represents a background task that has been registered with the system. |
BackgroundTaskRegistrationGroup |
Provides grouping semantics so that background task registration can be maintained separately. |
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 |
Represents a trigger that is registered to advertise a Bluetooth LE advertisement in the background. |
BluetoothLEAdvertisementWatcherTrigger |
Represents a trigger that is registered to scan for Bluetooth LE advertisement in the background. |
CachedFileUpdaterTrigger |
Represents a trigger that launches a background task to enable the Cached File Updater contract. |
CachedFileUpdaterTriggerDetails |
Provides details about the cached file operation that invoked the trigger. |
ChatMessageNotificationTrigger |
Represents a trigger that is activated when there is a notification for a text message. |
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 |
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 |
Represents a trigger that launches a background task for processing changes to the contacts store. |
ContentPrefetchTrigger |
Provides the ability to run custom handlers when prefetching web resources. |
ConversationalAgentTrigger |
Represents a trigger that launches a background task for processing digital assistant communication through the Windows platform Agent Activation Runtime (AAR). |
CustomSystemEventTrigger |
This class allows you to specify a custom system trigger so that you can register it and respond when it is triggered by the system. |
DeviceConnectionChangeTrigger |
Represents a trigger that launches a background task when the connection status of a device changes. |
DeviceManufacturerNotificationTrigger |
Represents a trigger that launches a background task to enable device manufacturer operations. |
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 UWP 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 UWP device apps. The DeviceServicingTrigger background task allows your UWP 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.
Important This trigger cannot be used with single-process background tasks. |
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 UWP app and Windows Phone 8.x 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 |
Represents an event that causes a background task to run when changes occur to the list of devices. Returned by GetBackgroundTrigger. |
EmailStoreNotificationTrigger |
Represents a trigger that enables notification of changes to the email store. |
GattCharacteristicNotificationTrigger |
Represents a trigger that launches a background task when an incoming change notification is received for a Bluetooth LE GATT characteristic. |
GattServiceProviderTrigger |
Constructs a Generic Attributes (GATT) service that can be persisted in the background. |
GattServiceProviderTriggerResult |
This class contains the trigger created by GattServiceProviderTrigger.CreateAsync(). |
GeovisitTrigger |
Represents an event that triggers a Visits-related background task. |
LocationTrigger |
Represents a location event that triggers a background task. This is used for Geofencing. |
MaintenanceTrigger |
Represents a maintenance trigger. |
MediaProcessingTrigger |
Represents a trigger that launches a background task for performing media processing. |
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 available only to mobile operator apps and UWP app given privileged access by mobile network operators. For more information, see Mobile broadband. |
MobileBroadbandPcoDataChangeTrigger |
Represents a cellular protocol configuration option change event that triggers a background task to run. |
MobileBroadbandPinLockStateChangeTrigger |
Represents a trigger that indicates when the SIM PIN lock state has changed. This functionality is available only to mobile operator apps and UWP app given privileged access by mobile network operators. For more information, see Mobile broadband. |
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 available only to mobile operator apps and UWP app given privileged access by mobile network operators. For more information, see Mobile broadband. |
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 available only to mobile operator apps and UWP app given privileged access by mobile network operators. For more information, see Mobile broadband. |
NetworkOperatorDataUsageTrigger |
Represents a trigger that launches a background task when the local data counters estimate that usage (bytes sent and received) on the mobile broadband interface has changed by an actionable threshold. Note This functionality is available only to mobile operator apps and UWP apps given privileged access by mobile network operators. If you want to use this API and publish your app to the Microsoft Store, then you'll need special approval. For more information, see the Restricted capabilities section in the App capability declarations topic, and Mobile Broadband. |
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 |
Represents a mobile network operator notification trigger. |
PaymentAppCanMakePaymentTrigger |
This class represents a PaymentAppCanMakePayment trigger. |
PhoneTrigger |
Represents a phone event that triggers a background task. |
PushNotificationTrigger |
Represents an object that invokes a background work item on the app in response to the receipt of a raw notification. |
RcsEndUserMessageAvailableTrigger |
Represents a trigger that launches a background task when a new Rich Communication Services (RCS) message is available. |
RfcommConnectionTrigger |
Represents a trigger that launches a background task when an RFCOMM inbound or outbound connections are established. |
SecondaryAuthenticationFactorAuthenticationTrigger |
Represents a trigger that launches a background task on behalf of a companion device. |
SensorDataThresholdTrigger |
Represents a trigger that responds when a threshold limit for a sensor is crossed. |
SmartCardTrigger |
Represents an event triggered by a smart card. |
SmsMessageReceivedTrigger |
Represents a trigger that is raised when an SMS message has arrived. |
SocketActivityTrigger |
Represents a trigger that launches a background task for handling socket activity. |
StorageLibraryChangeTrackerTrigger |
Represents a file change within a StorageFolder that triggers a background task to run. |
StorageLibraryContentChangedTrigger |
Creates a trigger that will fire when a file is changed in a specified library. |
SystemCondition |
Represents a system condition that must be in effect for a background task to run. |
SystemTrigger |
Represents a system event that triggers a background task to run. |
TetheringEntitlementCheckTrigger |
Represents a tethering event that triggers a background task to run. |
TimeTrigger |
Represents a time event that triggers a background task to run. |
ToastNotificationActionTrigger |
Represents an event that causes a background task to run when the user performs an action on an interactive toast notification. |
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 |
Represents a trigger that fires when a UserNotification is added or removed. |
WiFiOnDemandHotspotConnectTrigger |
Represents an event that causes a background task to run when the user wishes to connect to a specific on-demand hotspot network. Your background task code should cast the value of the IBackgroundTaskInstance.TriggerDetails property to WiFiOnDemandHotspotConnectTriggerDetails. Note If you want to use this API in a UWP app, and publish your app to the Microsoft Store, then you'll need to request special approval to use the custom capability Microsoft.onDemandHotspotControl_8wekyb3d8bbwe (the On-Demand Network capability). For more info, see Custom capabilities. The On-Demand Network capability will be made available only to app developers building end-to-end Wi-Fi hotspot scenarios between a tethering-capable hardware device and a Windows PC. |
WiFiOnDemandHotspotUpdateMetadataTrigger |
Represents an event that causes a background task to run when the user opens the operating system (OS) Wi-Fi network list, as if to connect to a new Wi-Fi network. Note If you want to use this API in a UWP app, and publish your app to the Microsoft Store, then you'll need to request special approval to use the custom capability Microsoft.onDemandHotspotControl_8wekyb3d8bbwe (the On-Demand Network capability). For more info, see Custom capabilities. The On-Demand Network capability will be made available only to app developers building end-to-end Wi-Fi hotspot scenarios between a tethering-capable hardware device and a Windows PC. |
Interfaces
IBackgroundCondition |
Used to enforce the system condition object type. |
IBackgroundTask |
Provides a method to perform the work of a background task. |
IBackgroundTaskInstance |
Provides access to a background task instance. |
IBackgroundTaskInstance2 |
Provides access to a background task instance. Inherits from the IBackgroundTaskInstance interface and adds the GetThrottleCount method. |
IBackgroundTaskInstance4 |
Provides access to a background task instance including information about the user. |
IBackgroundTaskRegistration |
Provides access to a registered background task. |
IBackgroundTaskRegistration2 |
Provides access to a registered background task. Inherits from the IBackgroundTaskRegistration interface and adds the Trigger property. |
IBackgroundTaskRegistration3 |
Represents a background task that has been registered as part of a group of related background tasks. |
IBackgroundTrigger |
Represents the base interface for trigger events. |
Enums
AlarmAccessStatus |
Indicates whether the user has given permission for the app to set alarms. |
ApplicationTriggerResult |
The result of the request to trigger a background task. The RequestAsync method returns a value of this enumeration type. |
BackgroundAccessRequestKind |
Specifies the level of background activity that an app can request. |
BackgroundAccessStatus |
This enumeration specifies an app's ability to perform background activity.
|
BackgroundTaskCancellationReason |
Specifies the reasons for cancelling a background task. |
BackgroundTaskThrottleCounter |
Indicates the type of throttle count to check for in a GetThrottleCount request. |
BackgroundWorkCostValue |
Indicates the current cost of doing background work. Used as a hint to background tasks about how much work they can do. |
CustomSystemEventTriggerRecurrence |
Specifies when a CustomSystemEventTrigger may be activated. |
DeviceTriggerResult |
Indicates whether the device background task operation was allowed or denied, and if it was denied specifies the reason. |
EnergyUseLevel | |
LocationTriggerType |
Indicates a type of location event for a location background task trigger. |
MediaProcessingTriggerResult |
Specifies the result of a call to MediaProcessingTrigger.RequestAsync. |
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 |
Specifies the system events that can be used to trigger a background task. |
Delegates
BackgroundTaskCanceledEventHandler |
Represents a method that handles the cancellation of a background task. |
BackgroundTaskCompletedEventHandler |
Represents a method that handles completion events for a background task. |
BackgroundTaskProgressEventHandler |
Represents a method that handles progress update events for a background task. |