Jaa


BackgroundAccessStatus Enum

Definition

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

Apps must successfully call BackgroundExecutionManager.RequestAccessAsync before registering background tasks.

public enum class BackgroundAccessStatus
/// [Windows.Foundation.Metadata.ContractVersion(Windows.Foundation.UniversalApiContract, 65536)]
enum class BackgroundAccessStatus
[Windows.Foundation.Metadata.ContractVersion(typeof(Windows.Foundation.UniversalApiContract), 65536)]
public enum BackgroundAccessStatus
var value = Windows.ApplicationModel.Background.BackgroundAccessStatus.unspecified
Public Enum BackgroundAccessStatus
Inheritance
BackgroundAccessStatus
Attributes

Windows requirements

Device family
Windows 10 (introduced in 10.0.10240.0)
API contract
Windows.Foundation.UniversalApiContract (introduced in v1.0)

Fields

Name Value Description
Unspecified 0

The app cannot perform background activity in this state.

On Windows 8 and Windows 8.1, BackgroundExecutionManager.RequestAccessAsync displayed a dialog that asked the user if the app should run in the background. This value was returned if the user did not select "allow" or "don't allow" in the dialog box, or dismissed it without making a choice.

AllowedWithAlwaysOnRealTimeConnectivity 1

The app can set up background tasks, and, if it has the capability, can use the real-time connectivity (RTC) broker. This means that the app can function while the device is in the connected standby state.

This value is deprecated in Windows 10, version 1607.

On Windows 8 and Windows 8.1, BackgroundExecutionManager.RequestAccessAsync displayed a dialog that asked the user if the app should run in the background. This value was returned if the user chose "allow" in the dialog box. After this value had been returned, subsequent calls to the BackgroundExecutionManager.RequestAccessAsync method did not present the dialog box to the user.

AllowedMayUseActiveRealTimeConnectivity 2

The app can set up background tasks, but it cannot use the real-time connectivity (RTC) broker. This means that the app might not function while the device is in connected standby. Note that apps that do not specify RTC in their manifest will always demonstrate this behavior.

This value is deprecated in Windows 10, version 1607.

On Windows 8 and Windows 8.1, BackgroundExecutionManager.RequestAccessAsync displayed a dialog that asked the user if the app should run in the background. This value was returned if the user chose "allow" in the dialog box. After this value had been returned, subsequent calls to the BackgroundExecutionManager.RequestAccessAsync method did not present the dialog box to the user.

Denied 3

This value is deprecated in Windows 10, version 1607.

On Windows 8 and Windows 8.1, BackgroundExecutionManager.RequestAccessAsync displayed a dialog that asked the user if the app should run in the background. This value was returned if the user chose "don't allow" in the dialog box. After this value had been returned, subsequent calls to the BackgroundExecutionManager.RequestAccessAsync method did not present the dialog box to the user.

AlwaysAllowed 4

On devices that have a battery, the user has given the app permission in the battery use settings to always allow background access. Introduced in Windows 10, version 1607.

AllowedSubjectToSystemPolicy 5

The user has selected Balanced or System Managed in the battery use settings. Introduced in Windows 10, version 1607.

DeniedBySystemPolicy 6

On devices that have a battery, the user has selected Battery Optimized in the battery use settings and the system has chosen not to allow this application to run in the background based on system resources. Introduced in Windows 10, version 1607.

DeniedByUser 7

On devices that have a battery, the user has disabled the app from running in the background in the battery use settings. Introduced in Windows 10, version 1607.

Remarks

On devices that do not have a battery, the settings that allow an app to use background activity are found in the background apps settings. On devices that have a battery, background task settings can be found in the Battery use settings.

Declare the RTC capability in your app's manifest by specifying the Control channel background task in the Declarations tab. For more information, see How to set background connectivity options.

If all hardware RTC slots are full at the time that the app is added to the lock screen, and if the app has specified Control channel in its manifest, together with Timer or Push notification, it is added to the lock screen, but without RTC capability. The app can then make further requests to be added to the lock screen, which do not present UI to the user. If a hardware slot is open when one such request is made, the app will take that slot.

Version history

Windows version SDK version Value added
1607 14393 AllowedSubjectToSystemPolicy
1607 14393 AlwaysAllowed
1607 14393 DeniedBySystemPolicy
1607 14393 DeniedByUser

Applies to

See also