BackgroundDownloader BackgroundDownloader BackgroundDownloader BackgroundDownloader Class

Definition

Used to configure downloads prior to the actual creation of the download operation using CreateDownload. For an overview of Background Transfer capabilities, see Transferring data in the background. Download the Background Transfer sample for examples in JavaScript, C#, and C++.

Note

Background Transfer is primarily designed for long-term transfer operations for resources like video, music, and large images. For short-term operations involving transfers of smaller resources (i.e. a couple KB), use the Windows.Web.Http namespace.

public : sealed class BackgroundDownloader : IBackgroundDownloader, IBackgroundDownloader2, IBackgroundDownloader3, IBackgroundTransferBase
public sealed class BackgroundDownloader : IBackgroundDownloader, IBackgroundDownloader2, IBackgroundDownloader3, IBackgroundTransferBase
Public NotInheritable Class BackgroundDownloader Implements IBackgroundDownloader, IBackgroundDownloader2, IBackgroundDownloader3, IBackgroundTransferBase
var backgroundDownloader = new backgroundDownloader();
Attributes
Windows 10 requirements
Device family
Windows 10 (introduced v10.0.10240.0)
API contract
Windows.Foundation.UniversalApiContract (introduced v1)
Capabilities
internetClientServer privateNetworkClientServer internetClient

Examples

The following example demonstrates how to configure and begin a basic download operation, and is based on the Background Transfer sample offered in the Windows Sample Gallery.

        var download = null;
        var promise = null;

        function DownloadFile (uriString, fileName) {
            try {
                // Asynchronously create the file in the pictures folder.
                Windows.Storage.KnownFolders.picturesLibrary.createFileAsync(fileName, Windows.Storage.CreationCollisionOption.generateUniqueName).done(function (newFile) {
                    var uri = Windows.Foundation.Uri(uriString);
                    var downloader = new Windows.Networking.BackgroundTransfer.BackgroundDownloader();

                    // Create a new download operation.
                    download = downloader.createDownload(uri, newFile);

                    // Start the download and persist the promise to be able to cancel the download.
                    promise = download.startAsync().then(complete, error, progress);
                }, error);
            } catch (err) {
                displayException(err);
            }
        };

       using Windows.Foundation;
       using Windows.Networking.BackgroundTransfer;
       using Windows.Storage;

       private async void StartDownload_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                Uri source = new Uri(serverAddressField.Text.Trim());
                string destination = fileNameField.Text.Trim();

                StorageFile destinationFile = await KnownFolders.PicturesLibrary.CreateFileAsync(
                    destination, CreationCollisionOption.GenerateUniqueName);

                BackgroundDownloader downloader = new BackgroundDownloader();
                DownloadOperation download = downloader.CreateDownload(source, destinationFile);

                // Attach progress and completion handlers.
                HandleDownloadAsync(download, true);
            }
            catch (Exception ex)
            {
                LogException("Download Error", ex);
            }
        }

Remarks

After app termination, an app should enumerate all existing DownloadOperation instances at next start-up using GetCurrentDownloadsAsync. When a UWP app using Background Transfer is terminated, incomplete downloads will persist in the background. If the app is restarted after termination and operations from the previous session are not enumerated and re-attached to the current session, they will remain incomplete and continue to occupy resources.

Note

When an app is uninstalled any current or persisted Background Transfer operations associated with it are cleaned up.

Background transfer doesn't support concurrent downloads of the same Uri. So an app can download http://example.com/myfile.wmv once, or download it again after a previous download completed. An app shouldn't start two downloads of the same Uri concurrently, since this may result in truncated files.

When implementing a library for Background Transfer operations, and this same library is used by other apps or components, specify a uniquegroup name string (e.g. a GUID) when creating downloads. An download with a group name string can only be enumerated by providing the matching string to GetCurrentDownloadsAsync(String), and will not appear in GetCurrentDownloadsAsync calls without. This will ensure that other apps implementing that same library for downloads will not see your downloads.

Download operations via FTP are supported. However, for FTP operations, authentication credentials must be provided within the specified URI. For example, ftp://user:password@server/file.txt.

Security concerns can exist when download operations require a username and password for authentication. If the authentication model to be used is supported by WinINet, use the ServerCredential or ProxyCredential properties. These values will be securely saved in WinVault. For information on supported authentication methods, see Handling Authentication.

If the authentication model is not supported by WinINet, use HttpClient to implement custom authentication and obtain a download-specific secure token (cookie). Set the appropriate header to have the secure token value used for background transfer. The service should limit the validity of the secure token only to the file that is being downloaded.

Note

The secure token will be stored in clear text within the application’s folder.

Upload services that require the username and password be set in clear text in a custom header for each download file are insecure. Background transfer will cache the headers in clear text for the duration of the operation within the app’s folder.

Toast notifications

The BackgroundDownloader class in Windows 8.1 and Windows Server 2012 R2 supports options for the user to receive tile and toast notifications when a transfer is completed successfully or fails to complete.

An app that uses Windows.Networking.BackgroundTransfer to communicate through a toast notification must declare that it is Toast capable in the app manifest file. The Toast capable setting is located under the Notifications section of Application tab. Set the Toast capable option to "Yes" so the app can receive toast notifications.

If Toast capable is not enabled in the app manifest, then any toast settings in the Windows.Networking.BackgroundTransfer namespace will be silently ignored and no toasts notifications will be received by the app.

Note

A user can manually disable or enable toast notifications for your app at any time.

For more information on toast notifications, see Sending toast notifications and How to opt in for toast notifications.

Handling exceptions

A number of errors can cause exceptions to occur during a download operation. You should write code to handle exceptions when you call methods on this class. Exceptions can result from parameter validation errors, name resolution failures, and network errors. Exceptions from network errors (loss of connectivity, connection failures, and other HTTP errors, for example) can happen at any time. These errors result in exceptions being thrown. If not handled by your app, an exception can cause your entire app to be terminated by the runtime.

An app can use the HRESULT from the exception to determine the error that caused the exception. An app can then decide how to handle the exception based on the error code. The BackgroundTransferError.GetStatus method can convert most HRESULT values returned to a WebErrorStatus enumeration value. Most of the WebErrorStatus enumeration values correspond to an error returned by the native HTTP or FTP client operation. An app can filter on specific WebErrorStatus enumeration values to modify app behavior depending on the cause of the exception.

For information on network exceptions, see Handling exceptions in network apps.

Debugging Guidance

Stopping a debugging session in Microsoft Visual Studio is comparable to closing your app. Even while debugging, your app should enumerate and then, resume, restart, or cancel any downloads persisted from the previous session. For example, you can have your app cancel enumerated persisted download operations at app startup if there is no interest in previous operations for the current debug session.

If there are Microsoft Visual Studio project updates, like changes to the app manifest, and the app is uninstalled and re-deployed, GetCurrentUploadsAsync cannot enumerate operations created using the previous app deployment.

See Debugging and testing UWP apps for more information.

When using Background Transfer during development, you may get into a situation where the internal caches of active and completed transfer operations can get out of sync. This may result in the inability to start new transfer operations or interact with existing operations and BackgroundTransferGroup objects. In some cases, attempting to interact with existing operations may trigger a crash. This result can occur if the TransferBehavior property is set to Parallel. This issue occurs only in certain scenarios during development and is not applicable to end users of your app.

Four scenarios using Microsoft Visual Studio can cause this issue.

  • You create a new project with the same app name as an existing project, but a different language (from C++ to C#, for example).
  • You change the target architecture (from x86 to x64, for example) in an existing project.
  • You change the culture (from neutral to en-US, for example) in an existing project.
  • You add or remove a capability in the package manifest (adding Enterprise Authentication, for example) in an existing project. Regular app servicing, including manifest updates which add or remove capabilities, do not trigger this issue on end user deployments of your app.

To work around this issue, completely uninstall all versions of the app and re-deploy with the new language, architecture, culture, or capability. This can be done via the Start screen or using PowerShell and the <cmd_line>Remove-AppxPackage</cmd_line> cmdlet.

Constructors

BackgroundDownloader() BackgroundDownloader() BackgroundDownloader() BackgroundDownloader()

BackgroundDownloader(BackgroundTransferCompletionGroup) BackgroundDownloader(BackgroundTransferCompletionGroup) BackgroundDownloader(BackgroundTransferCompletionGroup) BackgroundDownloader(BackgroundTransferCompletionGroup)

Creates a new BackgroundDownloader object with a BackgroundTransferCompletionGroup.

public : BackgroundDownloader(BackgroundTransferCompletionGroup completionGroup)
public BackgroundDownloader(BackgroundTransferCompletionGroup completionGroup)
Public Sub New(completionGroup As BackgroundTransferCompletionGroup)
var backgroundDownloader = new backgroundDownloader(completionGroup);
Parameters
completionGroup
BackgroundTransferCompletionGroup BackgroundTransferCompletionGroup BackgroundTransferCompletionGroup BackgroundTransferCompletionGroup

The completion group to associate with this BackgroundDownloader object.

This parameter cannot be NULL.

Remarks

This constructor will associate all downloads created with the BackgroundTransferCompletionGroup passed in the completionGroup parameter. Once the Enable method is called on the BackgroundTransferCompletionGroup, no more additional downloads can be created using this BackgroundDownloader object.

See Also

Properties

CompletionGroup CompletionGroup CompletionGroup CompletionGroup

Gets the BackgroundTransferCompletionGroup associated with the BackgroundDownloader.

public : BackgroundTransferCompletionGroup CompletionGroup { get; }
public BackgroundTransferCompletionGroup CompletionGroup { get; }
Public ReadOnly Property CompletionGroup As BackgroundTransferCompletionGroup
var backgroundTransferCompletionGroup = backgroundDownloader.completionGroup;
See Also

CostPolicy CostPolicy CostPolicy CostPolicy

Gets or sets the cost policy for the background download operation.

public : BackgroundTransferCostPolicy CostPolicy { get; set; }
public BackgroundTransferCostPolicy CostPolicy { get; set; }
Public ReadWrite Property CostPolicy As BackgroundTransferCostPolicy
var backgroundTransferCostPolicy = backgroundDownloader.costPolicy;
backgroundDownloader.costPolicy = backgroundTransferCostPolicy;

FailureTileNotification FailureTileNotification FailureTileNotification FailureTileNotification

Gets or sets the TileNotification used to define the visuals, identification tag, and expiration time of a tile notification used to update the app tile when indicating failure of a download to the user.

public : TileNotification FailureTileNotification { get; set; }
public TileNotification FailureTileNotification { get; set; }
Public ReadWrite Property FailureTileNotification As TileNotification
var tileNotification = backgroundDownloader.failureTileNotification;
backgroundDownloader.failureTileNotification = tileNotification;
See Also

FailureToastNotification FailureToastNotification FailureToastNotification FailureToastNotification

Gets or sets the ToastNotification that defines the content, associated metadata, and events used in a toast notification to indicate failure of a download to the user.

public : ToastNotification FailureToastNotification { get; set; }
public ToastNotification FailureToastNotification { get; set; }
Public ReadWrite Property FailureToastNotification As ToastNotification
var toastNotification = backgroundDownloader.failureToastNotification;
backgroundDownloader.failureToastNotification = toastNotification;

Remarks

An app that uses Windows.Networking.BackgroundTransfer to communicate through a toast notification must declare that it is Toast capable in the app manifest file. The Toast capable setting is located under the Notifications section of Application tab. Set the Toast capable option to "Yes" so the app can receive toast notifications.

If Toast capable is not enabled in the app manifest, then any toast settings in the Windows.Networking.BackgroundTransfer namespace will be silently ignored and no toasts notifications will be received by the app.

Note

A user can manually disable or enable toast notifications for your app at any time.

For more information on toast notifications, see Sending toast notifications and How to opt in for toast notifications.

See Also

Group Group Group Group

Note

Group may be altered or unavailable for releases after Windows 8.1. Instead, use TransferGroup.

Gets or sets a string value (e.g. a GUID) indicating the group the transfer will belong to. A download operation with a group ID will only appear in operation enumerations using GetCurrentDownloadsAsync(String) with the specific group string value.

public : Platform::String Group { get; set; }
public string Group { get; set; }
Public ReadWrite Property Group As string
var string = backgroundDownloader.group;
backgroundDownloader.group = string;
Value
Platform::String string string string

The group name.

Method Method Method Method

Gets or sets the HTTP method used for the background download. The default method used for download operations is GET.

public : Platform::String Method { get; set; }
public string Method { get; set; }
Public ReadWrite Property Method As string
var string = backgroundDownloader.method;
backgroundDownloader.method = string;
Value
Platform::String string string string

The method to use for the background download. Setting this property will override the default method used for the operation.

ProxyCredential ProxyCredential ProxyCredential ProxyCredential

Gets or sets the proxy credentials for the background transfer.

public : PasswordCredential ProxyCredential { get; set; }
public PasswordCredential ProxyCredential { get; set; }
Public ReadWrite Property ProxyCredential As PasswordCredential
var passwordCredential = backgroundDownloader.proxyCredential;
backgroundDownloader.proxyCredential = passwordCredential;
Value
PasswordCredential PasswordCredential PasswordCredential PasswordCredential

The credentials used to authenticate with an HTTP proxy.

ServerCredential ServerCredential ServerCredential ServerCredential

Gets or sets the credentials to use to authenticate with the origin server.

Note

For downloads via FTP, authentication credentials must be provided within the specified URI. For example, ftp://user:password@server/file.txt.

public : PasswordCredential ServerCredential { get; set; }
public PasswordCredential ServerCredential { get; set; }
Public ReadWrite Property ServerCredential As PasswordCredential
var passwordCredential = backgroundDownloader.serverCredential;
backgroundDownloader.serverCredential = passwordCredential;
Value
PasswordCredential PasswordCredential PasswordCredential PasswordCredential

The credential to use for authentication.

SuccessTileNotification SuccessTileNotification SuccessTileNotification SuccessTileNotification

Gets or sets the TileNotification used to define the visuals, identification tag, and expiration time of a tile notification used to update the app tile when indicating success of a download to the user.

public : TileNotification SuccessTileNotification { get; set; }
public TileNotification SuccessTileNotification { get; set; }
Public ReadWrite Property SuccessTileNotification As TileNotification
var tileNotification = backgroundDownloader.successTileNotification;
backgroundDownloader.successTileNotification = tileNotification;
See Also

SuccessToastNotification SuccessToastNotification SuccessToastNotification SuccessToastNotification

Gets or sets the ToastNotification that defines the content, associated metadata, and events used in a toast notification to indicate success of a download to the user.

public : ToastNotification SuccessToastNotification { get; set; }
public ToastNotification SuccessToastNotification { get; set; }
Public ReadWrite Property SuccessToastNotification As ToastNotification
var toastNotification = backgroundDownloader.successToastNotification;
backgroundDownloader.successToastNotification = toastNotification;

Remarks

An app that uses Windows.Networking.BackgroundTransfer to communicate through a toast notification must declare that it is Toast capable in the app manifest file. The Toast capable setting is located under the Notifications section of Application tab. Set the Toast capable option to "Yes" so the app can receive toast notifications.

If Toast capable is not enabled in the app manifest, then any toast settings in the Windows.Networking.BackgroundTransfer namespace will be silently ignored and no toasts notifications will be received by the app.

Note

A user can manually disable or enable toast notifications for your app at any time.

For more information on toast notifications, see Sending toast notifications and How to opt in for toast notifications.

See Also

TransferGroup TransferGroup TransferGroup TransferGroup

Gets or sets the group that a download operation will belong to.

public : BackgroundTransferGroup TransferGroup { get; set; }
public BackgroundTransferGroup TransferGroup { get; set; }
Public ReadWrite Property TransferGroup As BackgroundTransferGroup
var backgroundTransferGroup = backgroundDownloader.transferGroup;
backgroundDownloader.transferGroup = backgroundTransferGroup;
See Also

Methods

CreateDownload(Uri, IStorageFile) CreateDownload(Uri, IStorageFile) CreateDownload(Uri, IStorageFile) CreateDownload(Uri, IStorageFile)

Initializes a DownloadOperation object that contains the specified Uri and the file that the response is written to.

public : DownloadOperation CreateDownload(Uri uri, IStorageFile resultFile)
public DownloadOperation CreateDownload(Uri uri, IStorageFile resultFile)
Public Function CreateDownload(uri As Uri, resultFile As IStorageFile) As DownloadOperation
var downloadOperation = backgroundDownloader.createDownload(uri, resultFile);
Parameters
uri
Uri Uri Uri Uri

The location of the resource.

resultFile
IStorageFile IStorageFile IStorageFile IStorageFile

The file that the response will be written to.

Returns

Remarks

Background transfer doesn't support concurrent downloads of the same Uri. So an app can download http://example.com/myfile.wmv once, or download it again after a previous download completed. An app shouldn't start two downloads of the same Uri concurrently, since this may result in truncated files.

Important

Creating a large number of transfers on the main UI thread with CreateDownload can result in degraded performance of your app's UI. If you are queuing up a large number of transfers, it is recommended that you call CreateDownload on a background worker thread as in the following example.

operation = await Task.Run(() => { return myDownloader.CreateDownload(uri, file); });
See Also

CreateDownload(Uri, IStorageFile, IStorageFile) CreateDownload(Uri, IStorageFile, IStorageFile) CreateDownload(Uri, IStorageFile, IStorageFile) CreateDownload(Uri, IStorageFile, IStorageFile)

Initializes a DownloadOperation object with the resource Uri, the file that the response is written to, and the request entity body.

public : DownloadOperation CreateDownload(Uri uri, IStorageFile resultFile, IStorageFile requestBodyFile)
public DownloadOperation CreateDownload(Uri uri, IStorageFile resultFile, IStorageFile requestBodyFile)
Public Function CreateDownload(uri As Uri, resultFile As IStorageFile, requestBodyFile As IStorageFile) As DownloadOperation
var downloadOperation = backgroundDownloader.createDownload(uri, resultFile, requestBodyFile);
Parameters
uri
Uri Uri Uri Uri

The location of the resource.

resultFile
IStorageFile IStorageFile IStorageFile IStorageFile

The file that the response will be written to.

requestBodyFile
IStorageFile IStorageFile IStorageFile IStorageFile

A file that represents the request entity body, which contains additional data the server requires before the download can begin. The file this object points to must be valid for the duration of the download.

Returns

Remarks

The resultant DownloadOperation supports scenarios where a valid download request contains specific data required by the server. For example, a website requires a filled out form before the download can take place.

Background transfer doesn't support concurrent downloads of the same Uri. So an app can download http://example.com/myfile.wmv once, or download it again after a previous download completed. An app shouldn't start two downloads of the same Uri concurrently, since this may result in truncated files.

Important

Creating a large number of transfers on the main UI thread with CreateDownload can result in degraded performance of your app's UI. If you are queuing up a large number of transfers, it is recommended that you call CreateDownload on a background worker thread as in the following example.

operation = await Task.Run(() => { return myDownloader.CreateDownload(uri, file); });
See Also

CreateDownloadAsync(Uri, IStorageFile, IInputStream) CreateDownloadAsync(Uri, IStorageFile, IInputStream) CreateDownloadAsync(Uri, IStorageFile, IInputStream) CreateDownloadAsync(Uri, IStorageFile, IInputStream)

Creates an asynchronous download operation that includes a URI, the file that the response will be written to, and the IInputStream object from which the file contents are read.

public : IAsyncOperation<DownloadOperation> CreateDownloadAsync(Uri uri, IStorageFile resultFile, IInputStream requestBodyStream)
public IAsyncOperation<DownloadOperation> CreateDownloadAsync(Uri uri, IStorageFile resultFile, IInputStream requestBodyStream)
Public Function CreateDownloadAsync(uri As Uri, resultFile As IStorageFile, requestBodyStream As IInputStream) As IAsyncOperation( Of DownloadOperation )
var iAsyncOperation = backgroundDownloader.createDownloadAsync(uri, resultFile, requestBodyStream);
Parameters
uri
Uri Uri Uri Uri

The location of the resource.

resultFile
IStorageFile IStorageFile IStorageFile IStorageFile

Represents the file that the response will be written to.

requestBodyStream
IInputStream IInputStream IInputStream IInputStream

A stream that represents the request entity body.

Returns

Remarks

Background transfer doesn't support concurrent downloads of the same Uri. So an app can download http://example.com/myfile.wmv once, or download it again after a previous download completed. An app shouldn't start two downloads of the same Uri concurrently, since this may result in truncated files.

See Also

GetCurrentDownloadsAsync() GetCurrentDownloadsAsync() GetCurrentDownloadsAsync() GetCurrentDownloadsAsync()

Returns a collection of pending downloads that are not associated with a BackgroundTransferGroup.

public : static IAsyncOperation<IVectorView<DownloadOperation>> GetCurrentDownloadsAsync()
public static IAsyncOperation<IReadOnlyList<DownloadOperation>> GetCurrentDownloadsAsync()
Public Static Function GetCurrentDownloadsAsync() As IAsyncOperation<IReadOnlyList<DownloadOperation>>( Of IVectorView )
var iAsyncOperation = Windows.Networking.BackgroundTransfer.BackgroundDownloader.getCurrentDownloadsAsync();
Returns
IAsyncOperation<IVectorView<DownloadOperation>> IAsyncOperation<IReadOnlyList<DownloadOperation>> IAsyncOperation<IReadOnlyList<DownloadOperation>> IAsyncOperation<IReadOnlyList<DownloadOperation>>

A collection of pending downloads for the current application instance.

Remarks

On Windows Phone, this method will return the error code HRESULT: 0x80040154 (REGDB_E_CLASSNOTREG) if the Internet capability is not declared in your app manifest. On Windows, this method will return the error code HRESULT: 0x80070005 (E_ACCESSDENIED) if the Internet capability is not declared in your app manifest. This capability is enabled by default in all Store app project templates.

See Also

GetCurrentDownloadsAsync(String) GetCurrentDownloadsAsync(String) GetCurrentDownloadsAsync(String) GetCurrentDownloadsAsync(String)

Note

GetCurrentDownloadsAsync(group) may be altered or unavailable for releases after Windows 8.1. Instead, use GetCurrentDownloadsForTransferGroupAsync.

Returns a collection of pending downloads for a specific Group.

public : static IAsyncOperation<IVectorView<DownloadOperation>> GetCurrentDownloadsAsync(Platform::String group)
public static IAsyncOperation<IReadOnlyList<DownloadOperation>> GetCurrentDownloadsAsync(String group)
Public Static Function GetCurrentDownloadsAsync(group As String) As IAsyncOperation<IReadOnlyList<DownloadOperation>>( Of IVectorView )
var iAsyncOperation = Windows.Networking.BackgroundTransfer.BackgroundDownloader.getCurrentDownloadsAsync(group);
Parameters
group
Platform::String String String String

A string indicating a specific group of transfers.

Returns
IAsyncOperation<IVectorView<DownloadOperation>> IAsyncOperation<IReadOnlyList<DownloadOperation>> IAsyncOperation<IReadOnlyList<DownloadOperation>> IAsyncOperation<IReadOnlyList<DownloadOperation>>

A collection of pending downloads for the specific group.

Remarks

On Windows Phone, this method will return the error code HRESULT: 0x80040154 (REGDB_E_CLASSNOTREG) if the Internet capability is not declared in your app manifest. On Windows, this method will return the error code HRESULT: 0x80070005 (E_ACCESSDENIED) if the Internet capability is not declared in your app manifest. This capability is enabled by default in all Store app project templates.

See Also

GetCurrentDownloadsForTransferGroupAsync(BackgroundTransferGroup) GetCurrentDownloadsForTransferGroupAsync(BackgroundTransferGroup) GetCurrentDownloadsForTransferGroupAsync(BackgroundTransferGroup) GetCurrentDownloadsForTransferGroupAsync(BackgroundTransferGroup)

Gets all downloads associated with the provided BackgroundTransferGroup.

public : static IAsyncOperation<IVectorView<DownloadOperation>> GetCurrentDownloadsForTransferGroupAsync(BackgroundTransferGroup group)
public static IAsyncOperation<IReadOnlyList<DownloadOperation>> GetCurrentDownloadsForTransferGroupAsync(BackgroundTransferGroup group)
Public Static Function GetCurrentDownloadsForTransferGroupAsync(group As BackgroundTransferGroup) As IAsyncOperation<IReadOnlyList<DownloadOperation>>( Of IVectorView )
var iAsyncOperation = Windows.Networking.BackgroundTransfer.BackgroundDownloader.getCurrentDownloadsForTransferGroupAsync(group);
Parameters
group
BackgroundTransferGroup BackgroundTransferGroup BackgroundTransferGroup BackgroundTransferGroup

Contains information used to identify a group of downloads.

Returns
IAsyncOperation<IVectorView<DownloadOperation>> IAsyncOperation<IReadOnlyList<DownloadOperation>> IAsyncOperation<IReadOnlyList<DownloadOperation>> IAsyncOperation<IReadOnlyList<DownloadOperation>>

A list of downloads currently associated with the specified group.

See Also

RequestUnconstrainedDownloadsAsync(IIterable) RequestUnconstrainedDownloadsAsync(IIterable) RequestUnconstrainedDownloadsAsync(IIterable) RequestUnconstrainedDownloadsAsync(IIterable)

Note

RequestUnconstrainedDownloadsAsync may be altered or unavailable for releases after Windows 10, version 1607. Instead, use CreateDownloadAsync.

Used to request an unconstrained download operation. When this method is called the user is provided with a UI prompt that they can use to indicate their consent for an unconstrained operation.An unconstrained transfer operation will run without the resource restrictions normally associated with background network operations while a device is running on battery.

public : static IAsyncOperation<UnconstrainedTransferRequestResult> RequestUnconstrainedDownloadsAsync(IIterable<DownloadOperation> operations)
public static IAsyncOperation<UnconstrainedTransferRequestResult> RequestUnconstrainedDownloadsAsync(IEnumerable<DownloadOperation> operations)
Public Static Function RequestUnconstrainedDownloadsAsync(operations As IEnumerable<DownloadOperation>) As IAsyncOperation( Of UnconstrainedTransferRequestResult )
var iAsyncOperation = Windows.Networking.BackgroundTransfer.BackgroundDownloader.requestUnconstrainedDownloadsAsync(operations);
Parameters
operations
IIterable<DownloadOperation> IEnumerable<DownloadOperation> IEnumerable<DownloadOperation> IEnumerable<DownloadOperation>

The download operation to run unconstrained.

Returns

SetRequestHeader(String, String) SetRequestHeader(String, String) SetRequestHeader(String, String) SetRequestHeader(String, String)

Used to set an HTTP request header.

public : void SetRequestHeader(Platform::String headerName, Platform::String headerValue)
public void SetRequestHeader(String headerName, String headerValue)
Public Function SetRequestHeader(headerName As String, headerValue As String) As void
backgroundDownloader.setRequestHeader(headerName, headerValue);
Parameters
headerName
Platform::String String String String

The header name.

headerValue
Platform::String String String String

The header value.

Remarks

This method allows the caller to set request headers. This method can be called multiple times for the same header. The values will then be concatenated.

See Also