On Windows, this enumeration specifies an app's ability to perform background activity and display a tile on the lock screen.. On Windows Phone, only indicates an app's ability to perform background activity.
On Windows, a call to Windows.ApplicationModel.Background.BackgroundExecutionManager.requestAccessAsync presents a dialog box through which the user must explicitly select "allow" or "don't allow" for the app's access to the lock screen. These values represent the outcome of that selection, which combines both the answer given by the user and the current set of apps selected for that user's lock screen.
On Windows Phone, all apps must successfully call Windows.ApplicationModel.Background.BackgroundExecutionManager.requestAccessAsync before registering any background tasks. The call does not present the user with a prompt. The BackgroundAccessStatus values returned by the method call have different meanings for phone apps which are called out below.
var value = Windows.ApplicationModel.Background.BackgroundAccessStatus.unspecified;
The BackgroundAccessStatus enumeration has these members.
|Unspecified | unspecified||0||
Windows: The user has not selected "allow" or "don't allow" in the dialog box, or dismissed it without making a choice.
Windows and Windows Phone: The app cannot perform background activity in this state. However, it can request permission from the user to do so through the RequestAccessAsync method.
|AllowedWithAlwaysOnRealTimeConnectivity | allowedWithAlwaysOnRealTimeConnectivity||1||
Windows: The user chose "allow" in the dialog box. The app is added to the lock screen, 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. After this value has been returned, subsequent calls to the RequestAccessAsync method do not present the dialog box to the user.
Windows Phone: This value is not used.
|AllowedMayUseActiveRealTimeConnectivity | allowedMayUseActiveRealTimeConnectivity||2||
Windows: The user chose "allow" in the dialog box. The app is added to the lock screen and 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. After this value has been returned, subsequent calls to the RequestAccessAsync method do not present the dialog box to the user.
Windows Phone: The app can register background tasks. This value must be received before any background task type can be registered.
|Denied | denied||3||
Windows: The user chose "don't allow" in the dialog box. The app is not added to the lock screen. After this value has been returned, subsequent calls to the RequestAccessAsync method do not present the dialog box to the user.
Windows Phone: The user has explicitly disabled background tasks for the application in Settings or the maximum number of background apps across the system has been reached.
On Windows, the settings that allow an app to use background activity and update its badge on the lock screen are found in the Settings charm or the Personalization page in PC Settings. On Windows Phone, background task settings can be found in the Battery Sense Settings page.
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.
Minimum supported client
Minimum supported server
|Windows Server 2012|
Minimum supported phone
|Windows Phone 8.1 [Windows Phone Silverlight 8.1 and Windows Runtime apps]|
- How to set background connectivity options
- Lock screen apps sample