BackgroundExecutionManager.RequestAccessKindForModernStandbyAsync 方法

定義

要求使用者同意,以允許應用程式在裝置處於連線待命模式時,在背景中執行指定的背景活動層級。 在 Desktop OS Edition 上,可能會提示使用者同意。

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)

參數

requestedAccess
BackgroundAccessRequestKind

來自 BackgroundAccessRequestKind 列舉的值,指定要求的背景存取類型。

reason
String

Platform::String

winrt::hstring

在提示中顯示的字串,系統會向使用者引發,以描述應用程式要求在背景中執行的原因。 例如,出現在 「應用程式顯示:」 之後的字串

傳回

非同步作業,會在完成時傳回布林值。 如果已授與要求,此值為 true;否則為 false。

屬性

Windows 需求

裝置系列
Windows 11 (已於 10.0.22000.0 引進)
API contract
Windows.Foundation.UniversalApiContract (已於 v14.0 引進)

適用於