BackgroundExecutionManager.RequestAccessAsync BackgroundExecutionManager.RequestAccessAsync BackgroundExecutionManager.RequestAccessAsync BackgroundExecutionManager.RequestAccessAsync BackgroundExecutionManager.RequestAccessAsync Method

Definition

Overloads

RequestAccessAsync() RequestAccessAsync() RequestAccessAsync() RequestAccessAsync() RequestAccessAsync()

Requests that the app be permitted to run background tasks.

RequestAccessAsync(String) RequestAccessAsync(String) RequestAccessAsync(String) RequestAccessAsync(String) RequestAccessAsync(String)

Asynchronously requests that the app be permitted to run background tasks.

RequestAccessAsync() RequestAccessAsync() RequestAccessAsync() RequestAccessAsync() RequestAccessAsync()

Requests that the app be permitted to run background tasks.

public : static IAsyncOperation<BackgroundAccessStatus> RequestAccessAsync()
static IAsyncOperation<BackgroundAccessStatus> RequestAccessAsync() const;
public static IAsyncOperation<BackgroundAccessStatus> RequestAccessAsync()
Public Shared Function RequestAccessAsync() As IAsyncOperation(Of BackgroundAccessStatus)
Windows.ApplicationModel.Background.BackgroundExecutionManager.requestAccessAsync().done( /* Your success and error handlers */ );

Returns

When the operation completes, it returns a member of the BackgroundAccessStatus enumeration that specifies the outcome.

Remarks

VersionBehavior
Windows 8/Windows 8.1Prompts 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.1Does not prompt the user, but must be called before registering any background tasks.
Windows 10Does 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 this method 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) RequestAccessAsync(String)

Asynchronously requests that the app be permitted to run background tasks.

public : static IAsyncOperation<BackgroundAccessStatus> RequestAccessAsync(Platform::String applicationId)
static IAsyncOperation<BackgroundAccessStatus> RequestAccessAsync(winrt::hstring applicationId) const;
public static IAsyncOperation<BackgroundAccessStatus> RequestAccessAsync(String applicationId)
Public Shared Function RequestAccessAsync(applicationId As String) As IAsyncOperation(Of BackgroundAccessStatus)
Windows.ApplicationModel.Background.BackgroundExecutionManager.requestAccessAsync(applicationId).done( /* Your success and error handlers */ );

Parameters

applicationId
String String String

The package-relative application identifier (PRAID) of the app to be permitted to run background tasks. The specified app must be in the same package as the calling app. For more info on the PRAID, see the Id attribute of the Application element.

If you are hosting background task(s) in an out-of-process COM server, separate from your main application, then pass as the argument for applicationId the PRAID of the application that defines the windows.backgroundTask extension in its own package manifest.

Returns

An asynchronous request operation. On successful completion, contains a member of the BackgroundAccessStatus enumeration that specifies the outcome.

Remarks

VersionBehavior
Windows 8/Windows 8.1Prompts 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.1Does not prompt the user, but must be called before registering any background tasks.
Windows 10Does 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 this method, or [RequestAccessAsync](https://docs.microsoft.com/uwp/api/windows.applicationmodel.background.backgroundexecutionmanager.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