Backing up data to the cloud

Often, an app will need to backup it's data, especially if the data took time, effort or money to collect. The Android Backup Service provides a means of preserving data that is more complex than simple shared preferences or files.

Getting ready...

In order to work with the backup API, we have to have registered our app package name with the Android Backup Service.

We do this on http://developer.android.com/google/backup/signup.html.

How to do it...

In this recipe, we will save a value to a file and read from a file. This can be a far more comprehensive set of actions on a larger dataset, but not necessary, for example:

  1. Our app is not going to do much with the data, so we can save our single value to the filesystem as a ...

Get Xamarin Mobile Development for Android Cookbook now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.