BackgroundAccessStatus enumeration

BackgroundAccessStatus enumeration

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

Note  

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

Syntax


public enum class BackgroundAccessStatus

Members

The BackgroundAccessStatus enumeration has these members.

MemberValueDescription
Unspecified | unspecified0

The app cannot perform background activity in this state.

On Windows 8 and Windows 8.1, 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 | allowedWithAlwaysOnRealTimeConnectivity1

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, 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 RequestAccessAsync method did not present the dialog box to the user.

AllowedMayUseActiveRealTimeConnectivity | allowedMayUseActiveRealTimeConnectivity2

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, 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 RequestAccessAsync method did not present the dialog box to the user.

Denied | denied3

This value is deprecated in Windows 10, version 1607.

On Windows 8 and Windows 8.1, 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 RequestAccessAsync method did not present the dialog box to the user.

AlwaysAllowed | alwaysAllowed4

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 | allowedSubjectToSystemPolicy5

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

DeniedBySystemPolicy | deniedBySystemPolicy6

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 | deniedByUser7

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.

Requirements (Windows 10 device family)

Device family

Universal, introduced version 10.0.10240.0

API contract

Windows.Foundation.UniversalApiContract, introduced version 1.0

Namespace

Windows.ApplicationModel.Background
Windows::ApplicationModel::Background [C++]

Metadata

Windows.Foundation.UniversalApiContract.winmd

Requirements (Windows 8.x and Windows Phone 8.x)

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

Attributes

[Version(0x06020000)]

See also

How to set background connectivity options
BackgroundExecutionManager.getAccessStatus
BackgroundExecutionManager.requestAccessAsync
Lock screen apps sample

 

 

Show:
© 2016 Microsoft