EN
Este conteúdo não está disponível em seu idioma, mas aqui está a versão em inglês.

BackgroundExecutionManager.RequestAccessAsync(String) | requestAccessAsync(String) method

Requests access for an app to run background tasks.

Syntax


Public Shared Function RequestAccessAsync(
  applicationId As String 
) As IAsyncOperation(Of BackgroundAccessStatus)

Parameters

applicationId

Type: String [JavaScript] | System.String [.NET] | Platform::String [C++]

The Package Relative Application ID (PRAID) of the app to be added to the lock screen. The specified app must be in the same package as the calling app.

Return value

Type: IAsyncOperation<BackgroundAccessStatus>

The object, bound to the app specified by applicationId, 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

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 8.1, this method does not prompt the user, but must be called before registering any background tasks. On Windows 10 Insider Preview, Windows Server Technical Preview, and Windows 10 Mobile Insider Preview, you do not need to add the app to the lock screen before the app registers background tasks. Due to these differences in behavior, the values returned by this method have different meanings depending on which type of app is calling it.

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 (device family)

Device family

Universal

API contract

Windows.Foundation.UniversalApiContract, introduced version 1.0

Namespace

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

Metadata

Windows.Foundation.UniversalApiContract.winmd

Requirements (operating system)

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

 

 

Mostrar:
© 2015 Microsoft