I have done the following to get SQLite database Backup/Restore working.
(1)get registration from Google.
[http://developer.android.com/google/backup/signup.html][1]
(2)Add the key to Manifest xml file
<application>
<meta-data android:name="com.google.android.backup.api_key"
android:value="backup_service_key_from_google" />
...
</application>
(3)Add my backagent agent in the XML file
<application
android:allowBackup="true"
android:label="@string/app_name"
android:theme="@style/AppTheme"
...
android:backupAgent="MyBackupAgent" android:restoreAnyVersion="true"
>
(4)Create a class called MyBackupAgent
class MyBackupAgent extends BackupAgentHelper{
@Override
public void onCreate(){
FileBackupHelper dbs = new FileBackupHelper(this, "../databases/"+SQLHelp.dbName);
addHelper(SQLHelp.dbName, dbs);
}
}
(5)Call the backup Manager for backup
BackupManager mBackupManager = new BackupManager(this);
mBackupManager.dataChanged();
After step 5, I do not see anything happening. I put a break point in MyBackupAgent. Nothing stops in the onCreate() function.
Any suggestions?