0

I noticed this paragraph in the BackgroundTransferService documentation:

This property allows applications to request that background transfers proceed when only a cellular connection is available and when the device is on battery power. This is only a preference setting. It does not guarantee that transfers will take place under these conditions. The default value is None, which indicates that transfers should occur only when a Wi-Fi connection is available and when the device is connected to external power.

http://msdn.microsoft.com/en-us/library/windowsphone/develop/hh286419(v=vs.105).aspx

I'm not a native english speaker, but does that means that the API will roll some dices to choose whether or not an upload will work, whatever are the preferences I chose, and that transfer can pause or fail?

I want to verify with you, as at first sight, it doesn't make sense to rely on randomness.

Shawn Kendrot
  • 12,425
  • 1
  • 25
  • 41
Léon Pelletier
  • 2,701
  • 2
  • 40
  • 67

1 Answers1

1

I agree that the wording can be confusing. Changing this setting allows the background transfer to occur if the phone is not connected to WiFi and not plugged in (which is the default). It's best to look at the available values.

None Allow transfers only when the device is using external power and has a Wi-Fi connection. This is the default setting.

AllowCellular Allow transfers when the device is connected to external power and has a Wi-Fi or cellular connection.

AllowBattery Allow transfers when there is a Wi-Fi connection and the device is using battery or external power.

AllowCellularAndBattery Allow transfers when the device is using battery or external power and has a Wi-Fi or cellular connection.

The default value states that transfers can ONLY happen when the phone has WiFi AND plugged in. By changing this value you allow the phone to not have WiFi and/or not plugged in. The transfer will still happen if connected to WiFi or pluggin in.

Hope this helps

Community
  • 1
  • 1
Shawn Kendrot
  • 12,425
  • 1
  • 25
  • 41
  • My concerns is that even when setting AllowCellularAndBattery, some uploads are put in the "waiting for external power" state. – Léon Pelletier Jul 13 '13 at 18:24
  • Could it be because when recreating some BackgroundTransfer, the Transferences are not set to AllowCellularAndBattery again? I thought I handled it everywhere but I'll check another time, as in your answer, it sounds like there is no "maybe" in the documentation. – Léon Pelletier Jul 13 '13 at 18:30
  • It depends on the size of the transfer. See the [Background Transfer Policies](http://msdn.microsoft.com/en-us/library/windowsphone/develop/hh202955(v=vs.105).aspx#BKMK_BackgroundTransferPolicies) documentation – Shawn Kendrot Jul 13 '13 at 18:32
  • Actually, I have an app ready for the store, and bugs start to happen once the phone as been unplugged, so I'm suspecting BTS. – Léon Pelletier Jul 13 '13 at 18:32
  • Again, there's ambiguity in this documentation that I have read and read again. I see that there are some distinction between =<5MB uploads, and 5MB to 20MB upload. It is 100% clear that a file under 5MB can be uploaded in any condition. It is less clear if the TransferPreferences -really- applies to the 5 to 20 files. – Léon Pelletier Jul 13 '13 at 18:35
  • Are you trying to upload or download? – Shawn Kendrot Jul 13 '13 at 18:47
  • Uploading a file with a size that varies between 2 MB to 18 MB. – Léon Pelletier Jul 13 '13 at 18:48
  • Keep in mind that the file itself is not the entire upload. The entire upload package needs to be below 20. So if you are at 18, you may be going over. – Shawn Kendrot Jul 13 '13 at 19:07
  • So, 2 MB and 15 MB. :) Anyway. I'll continue to try to debug my BTS. – Léon Pelletier Jul 13 '13 at 19:11
  • You're correct in an earlier statement about the file sizes. It will ignore the settings and require WiFi if the upload is over 5mb. It's part of the built in carrier/user protection from excessive data consumption. – David Gordon Jul 14 '13 at 20:50