Can I use the Android Cloud to back up my application's databases? What are some limits to this feature?
-
er, the only place I see Android Cloud is with respect to Cloud to Device Messaging, C2DM. But then "Android Cloud to Device Messaging (C2DM) is a service that helps developers send data from servers to their applications on Android devices" which is certainly not for backing up databases. Cloud? – DJC Feb 08 '11 at 19:35
-
There is a back up service, in which the backup transport saves the data to google servers – amiekuser Feb 09 '11 at 08:43
-
possible duplicate of [Android backup/restore: how to backup an internal database?](http://stackoverflow.com/questions/5282936/android-backup-restore-how-to-backup-an-internal-database) – George Stocker Dec 14 '11 at 16:22
-
1Well George this is not a duplicate as it was posted on Feb 8. – amiekuser Dec 27 '11 at 08:04
1 Answers
I came across the solution. Apparently it was there in the dev guide.Thought I should put it here so that others can be benefited from it.
The BackupAgentHelper class has SharedPreferencesBackupHelper to backup SharedPreferences files. FileBackupHelper to backup files from internal storage.
So in order to back up a database we need to extend BackupAgent to Back up data in a database. If you have an SQLite database that you want to restore when the user re-installs your application, you need to build a custom BackupAgent that reads the appropriate data during a backup operation, then create your table and insert the data during a restore operation.
Please visit this link for illustration: http://developer.android.com/guide/topics/data/backup.html#BackupAgent

- 1,630
- 1
- 19
- 31