title: Using BackgroundUploadAsync to upload file to SkyDrive after WP8 app has been closed
body: <p>So I made a simple Windows Phone 8 app that uploads a text file to the user's SkyDrive account. My code works fine while my app is running in the foreground, but when I attempt to upload a text file when my app is closing , it doesn't seem to work.</p>
  
  <p>I'm using the Live Connect SDK v5.3 for WP8.
  SDK link: <a href="http://msdn.microsoft.com/en-us/library/live/hh826550.aspx" rel="nofollow">http://msdn.microsoft.com/en-us/library/live/hh826550.aspx</a></p>
  
  <p>I'm using this piece of code to do the background upload when my app closes (when the user hits "back button" on their phone:</p>
  
  <pre><code>protected override void OnBackKeyPress(CancelEventArgs e)
  {
      SaveSkyDriveData();
      base.OnBackKeyPress(e);
  }
  
  public async Task SaveSkyDriveData()
  {
     var res = await client.BackgroundUploadAsync("me/skydrive", new Uri("/shared/transfers/MyData.txt", UriKind.RelativeOrAbsolute), OverwriteOption.Overwrite);
  }
  </code></pre>
  
  <p>Any ideas why this code doesn't work when the app is closing? I've read through the SDK that says this should work even after the app has been dismissed. Here's the SDK link for uploading files in the background: <a href="http://msdn.microsoft.com/en-us/library/live/hh826531.aspx#uploading_files" rel="nofollow">http://msdn.microsoft.com/en-us/library/live/hh826531.aspx#uploading_files</a></p>
  
  <p>Thanks!</p>