Windows Phone 8.1 - BackgroundTransferStatus for BackgroundUpload

540 views Asked by At

I'm using the BackgroundUploader to upload images/videos from the CameraRoll to a storage service. This is a WinRT app on Windows Phone 8.1

This works great until there are a large number of files to be uploaded. I was expecting there to be issues concerning battery and CPU usage, so I am checking the BackgroungTransferStatus of all the UploadOperations and was intending to show a message to the user if we encounter the PausedSystemPolicy status. This is the expected status if the phone decides to pause an upload.

My problem is that, while the upload definitely appears to be paused (it doesn't send an http posts) the status continues to say "Running". Moreover, cancelling the upload operation has no effect. It still continues to sit there saying "Running" with no bytes sent and no response received. Eventually, it does resume uploading but we seem to quickly hit whatever limit is the problem and we pause again. I understand the need for limits, it is the user experience I'm concerned about.

Why does an upload that has been paused still have a status of "Running"? Has anyone experienced anything similar?

1

There are 1 answers

2
kiewic On

This may happen if there are multiple downloads already running.

Lets say 5 downloads are running, and you queue a sixth one. The sixth download won't start immediately unless you mark it with BackgroundTransferPriority.High. The status of the operation shows as running, but it won't start sending or receiving data until a slot becomes available. Pausing an operation does not take effect immediately if the operation is in the queue. But once the operation becomes active, the pause instruction will be applied to the operation.

As a work around, you can keep an eye on the progress events. If the download is not providing any progress, you know it may be in the queue.