cordova-plugin-background-download
cordova-plugin-background-download copied to clipboard
WindowsPhone 8.1: BackgroundTransferRequest TransferPreferences
Hi, I've just found a issue on WP 8.1 According to https://msdn.microsoft.com/en-us/library/windows/apps/microsoft.phone.backgroundtransfer.transferpreferences%28v=vs.105%29.aspx?cs-save-lang=1&cs-lang=csharp&f=255&MSPPError=-2147217396#code-snippet-1
BackgroundTransferRequest has TransferPreferences value set to None by default, which means it allow file transfer only (!) if you are connected to external power and WiFi. In other case "transfer.TransferStatus" will have value "TransferStatus.WaitingForExternalPower" and script will not begin dowloading until you connect your phone to charger or computer.
I've done a workaround in src/wp/BackgroundDowload.cs @ line 74
transfer = new BackgroundTransferRequest(requestUri, downloadLocation); transfer.TransferPreferences = TransferPreferences.AllowCellularAndBattery;
But maybe you should consider to set this value as function optional parameter?