BackgroundExecutionManager.RequestAccessKindAsync Method
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Prompts the user whether they consent to allow the app to perform the specified level of background activity in the background. On the Desktop OS Edition this may present a prompt to the user for their consent.
public:
static IAsyncOperation<bool> ^ RequestAccessKindAsync(BackgroundAccessRequestKind requestedAccess, Platform::String ^ reason);
/// [Windows.Foundation.Metadata.Overload("RequestAccessKindAsync")]
/// [Windows.Foundation.Metadata.RemoteAsync]
static IAsyncOperation<bool> RequestAccessKindAsync(BackgroundAccessRequestKind const& requestedAccess, winrt::hstring const& reason);
[Windows.Foundation.Metadata.Overload("RequestAccessKindAsync")]
[Windows.Foundation.Metadata.RemoteAsync]
public static IAsyncOperation<bool> RequestAccessKindAsync(BackgroundAccessRequestKind requestedAccess, string reason);
function requestAccessKindAsync(requestedAccess, reason)
Public Shared Function RequestAccessKindAsync (requestedAccess As BackgroundAccessRequestKind, reason As String) As IAsyncOperation(Of Boolean)
Parameters
- requestedAccess
- BackgroundAccessRequestKind
The type of background activity the app wishes to perform.
- 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
True indicates that the user or the system approved the requested background activity; false, otherwise.
- Attributes
Windows requirements
Device family |
Windows 10, version 1803 (introduced in 10.0.17134.0)
|
API contract |
Windows.Foundation.UniversalApiContract (introduced in v6.0)
|