Peregrine
Peregrine

Reputation: 4556

BackgroundTransferService - When does TransferProgressChanged get called?

When using BackgroundTransferService on windows phone 7, is there any way to control how often TransferProgressChanged is called? I'm guessing that it's related to the size of the internal buffer used for the download, but I don't see any properties for setting this.

The BytesReceived values are not equally spaced, or even the same for repeated downloads of the same file, but appear to be about every 1% of the total file size.

This is OK for a small file, but makes for a very unresponsive user interface when downloading large (2GB movie) files.

Upvotes: 0

Views: 184

Answers (1)

calum
calum

Reputation: 1580

The BackgroundTransferService updates when the percentage downloaded changes (just on whole numbers as you have noted). This keeps in line with marketplace downloads etc. where the progress sometimes takes a long time to update (at least when I am forced to use my edge connection to download).

In your case if the files are that big I would use a second animation so the user knows that the download is still in progress. I would probably add a 'Downloading...' text above the actual percentage progress display and animate the ellipses.

It is relatively easy to report progress on a download that you perform yourself, but the BackgroundTransferService is controlled by the OS and hence must deal with resource allocation accross all apps. If you are using it then most of the time the user won't even see the progress display as they will be doing something else. This means that reporting progress too often is a waste of resources. If I was to download a 2GB file to my phone I would be checking progress every 20-30 minutes and I wouldn't be waiting for the progress display to be updated before I returned to whatever else I was doing.

Upvotes: 1

Related Questions