BackgroundExecutionManager.RequestAccessAsync() | requestAccessAsync() method

Applies to Windows and Windows Phone

On Windows, this method presents the user with a dialog box that requests that an app be added to the lock screen. On Windows Phone, this method does not prompt the user, but must be called before registering any background tasks.

Syntax


public static IAsyncOperation<BackgroundAccessStatus> RequestAccessAsync()

Parameters

This method has no parameters.

Return value

Type: IAsyncOperation<BackgroundAccessStatus>

The object, bound to the calling app, that is used to request that the app be added to the lock screen's apps list. When the operation completes, it returns a member of the BackgroundAccessStatus enumeration that specifies the outcome.

Remarks

This method must be called from the UI thread. If it is not called from the UI thread, in some cases you can see error code 0x80070490 (ERROR_NOT_FOUND) in place of 0x80070005 (E_ACCESSDENIED). Receipt of error code 0x80070490 is a good indication that you are not calling from the UI thread.

Requirements

Minimum supported client

Windows 8

Minimum supported server

Windows Server 2012

Minimum supported phone

Windows Phone 8.1 [Windows Phone Silverlight 8.1 and Windows Runtime apps]

Namespace

Windows.ApplicationModel.Background
Windows::ApplicationModel::Background [C++]

Metadata

Windows.winmd

See also

BackgroundExecutionManager
RequestAccessAsync(String)

 

 

Show:
© 2014 Microsoft