BackgroundExecutionManager BackgroundExecutionManager BackgroundExecutionManager BackgroundExecutionManager Class

Manage permission to run background tasks.

Syntax

Declaration

public static class BackgroundExecutionManagerpublic static class BackgroundExecutionManagerPublic Static Class BackgroundExecutionManager

Methods summary

Gets the app's background task execution capability.

Gets the specified app's background task execution capability.

Removes the calling app from the list of apps that may run background tasks.

Removes a specific app from the list of apps that may run background tasks.

Requests that the app be permitted to run background tasks.

Requests that the app be permitted to run background tasks.

Methods

  • GetAccessStatus()
    GetAccessStatus()
    GetAccessStatus()
    GetAccessStatus()

    Gets the app's background task execution capability.

    public static BackgroundAccessStatus GetAccessStatus()public static BackgroundAccessStatus GetAccessStatus()Public Static Function GetAccessStatus() As BackgroundAccessStatus

    Returns

  • GetAccessStatus(System.String)
    GetAccessStatus(System.String)
    GetAccessStatus(System.String)
    GetAccessStatus(System.String)

    Gets the specified app's background task execution capability.

    public static BackgroundAccessStatus GetAccessStatus(System.String applicationId)public static BackgroundAccessStatus GetAccessStatus(System.String applicationId)Public Static Function GetAccessStatus(applicationId As System.String) As BackgroundAccessStatus

    Parameters

    • applicationId
      System.String
      System.String
      System.String
      System.String

      The Package Relative Application ID (PRAID) of the app whose capabilities are being retrieved. The specified app must be in the same package as the calling app.

    Returns

  • RemoveAccess()
    RemoveAccess()
    RemoveAccess()
    RemoveAccess()

    Removes the calling app from the list of apps that may run background tasks.

    public static void RemoveAccess()public static void RemoveAccess()Public Static Function RemoveAccess() As void
  • RemoveAccess(System.String)
    RemoveAccess(System.String)
    RemoveAccess(System.String)
    RemoveAccess(System.String)

    Removes a specific app from the list of apps that may run background tasks.

    public static void RemoveAccess(System.String applicationId)public static void RemoveAccess(System.String applicationId)Public Static Function RemoveAccess(applicationId As System.String) As void

    Parameters

    • applicationId
      System.String
      System.String
      System.String
      System.String

      The Package Relative Application ID (PRAID) of the app to be removed from the list of apps that may run background tasks. The specified app must be in the same package as the calling app.

  • RequestAccessAsync()
    RequestAccessAsync()
    RequestAccessAsync()
    RequestAccessAsync()

    Requests that the app be permitted to run background tasks.

    public static IAsyncOperation<BackgroundAccessStatus> RequestAccessAsync()public static IAsyncOperation<BackgroundAccessStatus> RequestAccessAsync()Public Static Function RequestAccessAsync() As IAsyncOperation( Of BackgroundAccessStatus )

    Returns

    • When the operation completes, it returns a member of the BackgroundAccessStatus enumeration that specifies the outcome.

    Remarks

    VersionBehavior
    Windows 8/Windows 8.1Prompts the user with a dialog box that requests that an app be added to the lock screen. Must be called before registering any background tasks.
    Windows Phone 8.1Does not prompt the user, but must be called before registering any background tasks.
    Windows 10Does not prompt the user, but must be called before registering any background tasks. You do not need to add the app to the lock screen in order to use background tasks in Windows 10, but you still need to call RequestAccessAsync(System.String) to request background access.
    Tip

    Starting with Windows 10, it is no longer necessary to call this method from the UI thread.

  • RequestAccessAsync(System.String)
    RequestAccessAsync(System.String)
    RequestAccessAsync(System.String)
    RequestAccessAsync(System.String)

    Requests that the app be permitted to run background tasks.

    public static IAsyncOperation<BackgroundAccessStatus> RequestAccessAsync(System.String applicationId)public static IAsyncOperation<BackgroundAccessStatus> RequestAccessAsync(System.String applicationId)Public Static Function RequestAccessAsync(applicationId As System.String) As IAsyncOperation( Of BackgroundAccessStatus )

    Parameters

    • applicationId
      System.String
      System.String
      System.String
      System.String

      The Package Relative Application ID (PRAID) of the app to be permitted to run background tasks. The specified app must be in the same package as the calling app.

    Returns

    • When the operation completes, it returns a member of the BackgroundAccessStatus enumeration that specifies the outcome.

    Remarks

    VersionBehavior
    Windows 8/Windows 8.1Prompts the user with a dialog box that requests that an app be added to the lock screen. Must be called before registering any background tasks.
    Windows Phone 8.1Does not prompt the user, but must be called before registering any background tasks.
    Windows 10Does not prompt the user, but must be called before registering any background tasks. You do not need to add the app to the lock screen in order to use background tasks in Windows 10, but you still need to call RequestAccessAsync(System.String) to request background access.
    Tip

    Starting with Windows 10, it is no longer necessary to call this method from the UI thread.

Device family

Windows 10 (introduced v10.0.10240.0)

API contract

Windows.Foundation.UniversalApiContract (introduced v1)

Attributes

Windows.Foundation.Metadata.StaticAttribute
Windows.Foundation.Metadata.ContractVersionAttribute

Details

Assembly

Windows.ApplicationModel.Background.dll