LiveConnectClient.BackgroundUploadAsync, is not working when phone not connected to usb

前端 未结 1 1998
谎友^
谎友^ 2021-01-19 04:57

I\'m trying to use LiveConnectClient.BackgroundUploadAsync in wp8, to upload copy of some data.

Her is my code:

var progress = new Progr         


        
1条回答
  •  隐瞒了意图╮
    2021-01-19 05:30

    You are facing 'problems' with BackgroundTransfer Policies.

    The operating system enforces a number of restrictions on background transfers related to file size, connection speeds, and device resources.

    Which means that when you download/upload larger files you need to change TransferPreferences - for example if you want to upload a file larger than 100 Mb you will be able to do that, but only via WiFi and while Phone is connected to external power source.

    In your App you should check for WiFi connection and power supply before starting downlod/upload and then inform the User that he should (for example) turn WiFi on to perform operation on such a big file.

    You can choose from:

    // small files but via 3G and on Battery
    liveClient.BackgroundTransferPreferences = BackgroundTransferPreferences.AllowCellularAndBattery;
    
    // larger files via WiFi, on Battery
    liveClient.BackgroundTransferPreferences = BackgroundTransferPreferences.AllowBattery;
    
    // huge files but only WiFi and External power
    liveClient.BackgroundTransferPreferences = BackgroundTransferPreferences.None;
    

    The default setting is none - so if you hadn't changed it, your App will wait for external power and WiFi - that is probably why it is working while connected via USB (external power).

    0 讨论(0)
提交回复
热议问题