BackgroundExecutionManager BackgroundExecutionManager BackgroundExecutionManager BackgroundExecutionManager Class

Manage permission to run background tasks.

Syntax

Declaration

public static class BackgroundExecutionManagerpublic 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 BackgroundAccessStatuspublic static BackgroundAccessStatus GetAccessStatus()

    Returns

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

    Gets the specified app's background task execution capability.

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

    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 voidpublic static void RemoveAccess()
  • RemoveAccess(String)
    RemoveAccess(String)
    RemoveAccess(String)
    RemoveAccess(String)

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

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

    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 )public static IAsyncOperation<BackgroundAccessStatus> RequestAccessAsync()

    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(String) to request background access.
    Tip

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

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

    Requests that the app be permitted to run background tasks.

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

    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(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.ContractVersionAttribute
Windows.Foundation.Metadata.StaticAttribute

Details

Assembly

Windows.ApplicationModel.Background.dll