Share via


BackgroundExecutionManager.RequestAccessKindForModernStandbyAsync Method

Definition

Requests user consent to allow the app to perform the specified level of background activity in the background while the device is in connected standby mode. On the Desktop OS Edition this may present a prompt to the user for their consent.

public:
 static IAsyncOperation<bool> ^ RequestAccessKindForModernStandbyAsync(BackgroundAccessRequestKind requestedAccess, Platform::String ^ reason);
/// [Windows.Foundation.Metadata.RemoteAsync]
 static IAsyncOperation<bool> RequestAccessKindForModernStandbyAsync(BackgroundAccessRequestKind const& requestedAccess, winrt::hstring const& reason);
[Windows.Foundation.Metadata.RemoteAsync]
public static IAsyncOperation<bool> RequestAccessKindForModernStandbyAsync(BackgroundAccessRequestKind requestedAccess, string reason);
function requestAccessKindForModernStandbyAsync(requestedAccess, reason)
Public Shared Function RequestAccessKindForModernStandbyAsync (requestedAccess As BackgroundAccessRequestKind, reason As String) As IAsyncOperation(Of Boolean)

Parameters

requestedAccess
BackgroundAccessRequestKind

A value from the BackgroundAccessRequestKind enumeration specifying the requested type of background access.

reason
String

Platform::String

winrt::hstring

The string to display in the prompt that the system will raise to the user to describe why the app is requesting to run in the background. For example, the string that appears after "The app says:"

Returns

An asynchronous operation that returns a boolean value on completion. The value is true if the request was granted; otherwise, false.

Attributes

Windows requirements

Device family
Windows 11 (introduced in 10.0.22000.0)
API contract
Windows.Foundation.UniversalApiContract (introduced in v14.0)

Applies to