BackgroundExecutionManager
BackgroundExecutionManager
BackgroundExecutionManager
BackgroundExecutionManager
Class
Definition
Manage permission to run background tasks.
public : static class BackgroundExecutionManagerpublic static class BackgroundExecutionManagerPublic Static Class BackgroundExecutionManager// You can use this class in JavaScript.
- Attributes
| Device family |
Windows 10 (introduced v10.0.10240.0)
|
| API contract |
Windows.Foundation.UniversalApiContract (introduced v1)
|
Methods
GetAccessStatus() GetAccessStatus() GetAccessStatus() GetAccessStatus()
Gets the app's background task execution capability.
public : static BackgroundAccessStatus GetAccessStatus()public static BackgroundAccessStatus GetAccessStatus()Public Static Function GetAccessStatus() As BackgroundAccessStatus// You can use this method in JavaScript.
An enumeration value that specifies the app's background capabilities.
- See Also
GetAccessStatus(String) GetAccessStatus(String) GetAccessStatus(String) GetAccessStatus(String)
Gets the specified app's background task execution capability.
public : static BackgroundAccessStatus GetAccessStatus(PlatForm::String applicationId)public static BackgroundAccessStatus GetAccessStatus(String applicationId)Public Static Function GetAccessStatus(applicationId As String) As BackgroundAccessStatus// You can use this method in JavaScript.
- applicationId
- PlatForm::String String String String
The Package Relative Application ID (PRAID) of the app whose capabilities are being retrieved. The specified app must be in the same package as the calling app.
An enumeration value that specifies the app's background capabilities.
- See Also
RemoveAccess() RemoveAccess() RemoveAccess() RemoveAccess()
Removes the calling app from the list of apps that may run background tasks.
public : static void RemoveAccess()public static void RemoveAccess()Public Static Function RemoveAccess() As void// You can use this method in JavaScript.
- See Also
RemoveAccess(String) RemoveAccess(String) RemoveAccess(String) RemoveAccess(String)
Removes a specific app from the list of apps that may run background tasks.
public : static void RemoveAccess(PlatForm::String applicationId)public static void RemoveAccess(String applicationId)Public Static Function RemoveAccess(applicationId As String) As void// You can use this method in JavaScript.
- applicationId
- PlatForm::String String String String
The Package Relative Application ID (PRAID) of the app to be removed from the list of apps that may run background tasks. The specified app must be in the same package as the calling app.
- See Also
RequestAccessAsync() RequestAccessAsync() RequestAccessAsync() RequestAccessAsync()
Requests that the app be permitted to run background tasks.
public : static IAsyncOperation<BackgroundAccessStatus> RequestAccessAsync()public static IAsyncOperation<BackgroundAccessStatus> RequestAccessAsync()Public Static Function RequestAccessAsync() As IAsyncOperation( Of BackgroundAccessStatus )// You can use this method in JavaScript.
When the operation completes, it returns a member of the BackgroundAccessStatus enumeration that specifies the outcome.
Remarks
| Version | Behavior |
| Windows 8/Windows 8.1 | Prompts the user with a dialog box that requests that an app be added to the lock screen. Must be called before registering any background tasks. |
| Windows Phone 8.1 | Does not prompt the user, but must be called before registering any background tasks. |
| Windows 10 | Does not prompt the user, but must be called before registering any background tasks. You do not need to add the app to the lock screen in order to use background tasks in Windows 10, but you still need to call RequestAccessAsync to request background access. |
Tip
Starting with Windows 10, it is no longer necessary to call this method from the UI thread.
- See Also
RequestAccessAsync(String) RequestAccessAsync(String) RequestAccessAsync(String) RequestAccessAsync(String)
Requests that the app be permitted to run background tasks.
public : static IAsyncOperation<BackgroundAccessStatus> RequestAccessAsync(PlatForm::String applicationId)public static IAsyncOperation<BackgroundAccessStatus> RequestAccessAsync(String applicationId)Public Static Function RequestAccessAsync(applicationId As String) As IAsyncOperation( Of BackgroundAccessStatus )// You can use this method in JavaScript.
- applicationId
- PlatForm::String String String String
The Package Relative Application ID (PRAID) of the app to be permitted to run background tasks. The specified app must be in the same package as the calling app.
When the operation completes, it returns a member of the BackgroundAccessStatus enumeration that specifies the outcome.
Remarks
| Version | Behavior |
| Windows 8/Windows 8.1 | Prompts the user with a dialog box that requests that an app be added to the lock screen. Must be called before registering any background tasks. |
| Windows Phone 8.1 | Does not prompt the user, but must be called before registering any background tasks. |
| Windows 10 | Does not prompt the user, but must be called before registering any background tasks. You do not need to add the app to the lock screen in order to use background tasks in Windows 10, but you still need to call RequestAccessAsync to request background access. |
Tip
Starting with Windows 10, it is no longer necessary to call this method from the UI thread.
- See Also