Developers: Use SkyDrive to Backup App Data

Reading time icon 3 min. read

Readers help support MSpoweruser. We may get a commission if you buy through our links. Tooltip Icon

Read our disclosure page to find out how can you help MSPoweruser sustain the editorial team Read more

One of the issues with Windows Phone is that you lose all your apps’ data when you upgrade to a new phone. However, developers can fix this by quickly implementing a backup/restore system via SkyDrive.

I realized that Windows Phone apps needed a backup solution, and so I added a simple SkyDrive backup system to my homework planner app, Power Planner. If you’re a developer, read the tutorial below to learn how to add the same system to your app!


Live Connect Account
First, you’ll have to setup a SkyDrive API account if you don’t have one. Go to the Live Connect site and login. It should prompt you to add your app’s details. Fill in your app name and language and click I Accept. Then go to the Application Settings Page, open the API Settings, and change the Mobile client app option to YES. Copy your Client ID number because you’ll need it later!


Live SDK
Now you need to download the Live SDK if you haven’t already. Go to Microsoft’s Download Page and download/install the MSI.


Adding References in your Project
Don’t forget to add the references to the Live SDK in your Visual Studio project! Add Microsoft.Live and Microsoft.Live.Controls to your references. Also, add System.Xml.Serialization (it’s used to serialize your data into a text file for uploading to SkyDrive).


Adding the Backup Page
Download my pre-existing backup page (click Save). After it is downloaded, right click the ZIP file and click the “Unblock” button to ensure the code files can be read. Then, unzip the file, and copy the two code files (xaml and xaml.cs) into your project.

Look through the xaml.cs page and change all the items that have “CHANGE” commented next to them. And then on the xaml page, change the namespace to your project and the ClientId number to your own.


Finishing it up
On your app’s settings page, make an entry for “backup” that opens the new backup page. Your settings page should be a separate page, not something on your panorama! And settings pages do NOT use pivot controls!


Final project sample
You can download a complete project sample here to see how everything works together. Also, you can download Power Planner in the Marketplace to see how this sample works with an app currently in the Marketplace.

More about the topics: backup, developers, tutorial