Search code examples
windows-phone-7windows-phone-7.1background-transfer

BackgroundTransferService: what are some of the details of its operation?


I kick off 5 uploads (of varying size) via the BackgroundTransferService. I have the following questions about the way it works:

  1. It seems that on the emulator it does 2 uploads at a time. Is this how it works on the actual device? Can I programmatically change this behavior?
  2. Can I count on the uploads going out in the order that I submitted them? I seem to be getting conflicting results in my testing.
  3. When I inspect the BackgroundTransferService in my application, does it contain requests from other apps as well or just mine?
  4. Do I need to reconnect events for all the BackgroundTransferRequest objects when coming back from being tombstoned? What about coming back from being reactivated?
  5. Do I need to disconnect events from the BackgroundTransferRequest when I remove it from the BackgroundTransferService.Requests collection?
  6. When I try to upload a non-existing URL:Port (on the localhost), the TransferStatus is reported as WaitingForNonVoiceBlockingNetwork. The upload never actually completes/fails. Is this how it is on the device? Should I remove the request when it encounters this TransferStatus?

Solution

    1. You cannot influence the behaviour of the BTS. If you don't like the way it works you can write the transfer functionality as part of your own application but then you have to handle running in the background yourself.

    2. There is no guarantee on sequence.

    3. The BTS may be handling requests from other apps but you won't be able to see the details. Requests() will only return details for your app.

    4. Surely a quick test will tell you this.

    5. It's good practice to.

    6. Have you checked the TransferError property whe you reach this situation? This is a perfectly valild status in other situations and so you shouldn't treat this as a automatic fail.