Most apps will need some sort of backup for the various customizations that the app permits, especially if the app does not have a dedicated server to store those settings. The Android Backup Service provides a simple means of preserving data.
Adding backup support for shared preferences and files is very easy and very simple. Let's take a look at the following steps:
Before we start, we have to register our app with the Android Backup Service: http://developer.android.com/google/backup/signup.html
On the form, enter the application package name and click on Register.
Make a note of the key that is provided and create a
[MetaData]
attribute in our app with the value being the key:[assembly: MetaData( "com.google.android.backup.api_key", Value = "AndroidBackupServiceKey")]
To create our backup agent, we need to inherit from
BackupAgentHelper
:public class BackupHelper : BackupAgentHelper { public override void OnCreate() { } ...