1 / 13

Strategies for Transferring User Data Files in your WP7 Apps

Strategies for Transferring User Data Files in your WP7 Apps. By Jay E. Kimble The Dev Theologian http://jaykimble.net. Disclaimers About This Talk. Prescriptive session – not necessarily instructive (Emphasis is on Strategy) I am growing, too Let’s make this a dialog

frye
Download Presentation

Strategies for Transferring User Data Files in your WP7 Apps

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Strategies for Transferring User Data Files in your WP7 Apps By Jay E. KimbleThe Dev Theologian http://jaykimble.net

  2. Disclaimers About This Talk • Prescriptive session – not necessarily instructive (Emphasis is on Strategy) • I am growing, too • Let’s make this a dialog • The first 2 demos work in WP7 (& in 7.1) • The final is about Background Transfers (Mango only)

  3. Background • For WP7.0, I built an app that relies on data files that are end-user supplied • This was not a problem for my WinMo app • I used • a personally created lib for DropBox (but there are numerous options available) • IsolatedStorage • A third party library to simplified WebRequests

  4. IsolatedStorage • IsolatedStorage is • a special storage area on the phone • for data files created by your app • for data files downloaded by your app • For WP7 (and WP7.1) there is no other local storage option available

  5. Demo 1: Getting our feet wet • Simple demo to download an image file (& display it) • We’ll use WebClient for this • We’ll store the resulting file in IsolatedStorage

  6. Download Queues • A Download Queue let’s a user manage the process of which files are downloading • It also let’s them start/stop transfers • We need a few objects to do this: • FileItem containing name, uri, progress, etc. • Collection of FileItems to choose from • Collection of FileItemsthat are queued to download • Downloader Object

  7. Demo2: Download Queue • Let’s look at an implementation of this

  8. Background File Transfers (BgXfers) • Simplifies the mess of managing requests • Only really needs a URI • You do need to handle Tombstoning so your app can remember what was downloading between sessions • API is controlled via a single shares object which you add transfer requests to

  9. Download Queue == BG Xfers Best Practice • By building the Download Queue we actually took care of all the recommended UI! • The only things missing from our UI is • A settings mechanism for the user to control when a transfer can happen • Can it happen on battery? • Can it happen on a Cell Data Connection

  10. TombstoningSidenote • Tombstoning is the process where the OS tells your app • it will be shutting down to free up memory • an app must save off it’s state immediately • A separate set of events fire when an app is restored from tombstoning • With BgXfers you need to always save the state of the transfers when the app is shutting down normally or Tombstoning

  11. Demo3: Background Transfers • This demo will create a new MangoDownloader which will BG Transfers (we can actually download up to 5 items at a time!)

  12. BgXfers Caveats/Notes • It does not work with all Cloud Services • It doesn’t work with SugarSync’s public storage • HTTP/HTTPS only (no FTP.. yet..) • It will work with other HTTP verbs (post) • You can pass post variables and some headers via properties in the Transfer Object • Different types of connections have size limitations (be aware of this.. You aren’t downloading a 100mb file on a 3g connection!)

  13. Resources • BG Xfers • See the docs on MSDN (especially the best practices • Fla-wimo-dev.groups.live.com • Joe’s wiki –dfwiki.devfish.net • Wp7dev.wikispaces.com

More Related