Backup app data with BackupManager

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

Backup app data with BackupManager

Igor Velikorossov

Google provides data backup service (https://developer.android.com/guide/topics/data/backup.html), which I'm trying to take advantage of.

I followed the instructions, but I can't seem to get it working. I've done the following:

  1. Registered for the backup service and got the key
  2. Updated the manifest.xml

    
    <application android:backupAgent="app.namespace.MyBackupAgentHelper"
                 android:restoreAnyVersion="true">
    
        <!-- backup service registration -->
        <meta-data android:name="com.google.android.backup.api_key" 
                   android:value="xxxxxxxxxxxxxxxxxxxxxx" />
  3. Extended BackupAgentHelper

    
    namespace App.Namespace
    {
        public class MyBackupAgentHelper : BackupAgentHelper
        {
            public override void OnCreate()
            {
                base.OnCreate();
                var fbh = new FileBackupHelper(this, this.GetDatabasePath(Const.Database.Name).AbsolutePath);
                this.AddHelper("DATABASE", fbh);
            }
        }
    }
  4. In my database helper I initialise BackupManager and upon data change call this.backupManager.DataChanged();

And it doesn't seem to work as expected - when I uninstall and reinstall the app the database I expect to be backup isn't getting restored.

I have also tried instigating backup manually (as per instructionshttps://developer.android.com/guide/topics/data/backup.html#Testing) to no avail.

Any help is appreciated. Thanks


_______________________________________________
Monodroid mailing list
[hidden email]

UNSUBSCRIBE INFORMATION:
http://lists.ximian.com/mailman/listinfo/monodroid