EN
Este conteúdo não está disponível em seu idioma, mas aqui está a versão em inglês.

Windows.ApplicationModel.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 (Windows Store apps using JavaScript and HTML) or Supporting your app with background tasks (Windows Store apps using C#/VB/C++ and XAML) for guidance on implementing background tasks. For a general overview of background tasks in Windows Store apps, see the Introduction to Background Tasks whitepaper. For example code that shows how to implement background tasks, see the Background Task Sample.

Members

The Windows.ApplicationModel.Background namespace has these types of members:

Classes

The Windows.ApplicationModel.Background namespace has these classes.

ClassDescription
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.
ApplicationTrigger This is used to trigger background tasks.
ApplicationTriggerDetails The details of an ApplicationTrigger.
AppointmentStoreNotificationTrigger Represents a trigger that launches a background task for processing changes to the appointment store.
BackgroundExecutionManager Provides methods that let an app ask to be added to the lock screen's apps list or query its current access to background activity and badge updates on the lock screen.
BackgroundTaskBuilder Represents a background task to be registered 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.
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 This API is not available to all Windows/Windows Phone apps. Unless your developer account is specially provisioned by Microsoft, calls to these APIs will fail at runtime.
CommunicationBlockingAppSetAsActiveTrigger Represents a trigger to activate a communication blocking application when it is selected as the preferred blocking app.
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.
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.
DeviceUseTrigger Represents an event that a Windows Runtime app can trigger to initiate a long-running operation with a device or sensor.
DeviceWatcherTrigger Represents an event that causes a background task to run when changes occur to the list of devices.
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.
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.
NetworkOperatorHotspotAuthenticationTrigger Represents a mobile network operator hotspot authentication trigger.
NetworkOperatorNotificationTrigger Represents a mobile network operator notification 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.
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.
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.
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.

 

Delegates

The Windows.ApplicationModel.Background namespace has these delegates.

DelegateDescription
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.

 

Enumerations

The Windows.ApplicationModel.Background namespace has these enumerations.

EnumerationDescription
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.
BackgroundAccessStatus On Windows, this enumeration specifies an app's ability to perform background activity and display a tile on the lock screen. For Windows Phone Store app, it only indicates 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.
DeviceTriggerResult Indicates whether the device background task operation was allowed or denied, and if it was denied specifies the reason.
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.

 

Interfaces

The Windows.ApplicationModel.Background namespace defines these interfaces.

InterfaceDescription
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.
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.
IBackgroundTrigger Represents the base interface for trigger events.

 

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

Introduction to Background Tasks whitepaper
Background Task Sample app

 

 

Mostrar:
© 2015 Microsoft