0

I am developing an App for a lot of Devices, so that they aren't registered to a Google Account.

But I want to backup my SharedPreferences somewhere. In best case in a folder on the device.

So I tried to use the BackupAgentHelper, but this backups only to Google or can it backup somewhere else ?

Alternatively is there a way to copy the SharedPreferences to a place on the sdcard?

The problem is when I doing a update to my app (not trough the market) I lose all my data.

PS: Sorry for my bad englisch

HitOdessit
  • 7,198
  • 4
  • 36
  • 59
dominic
  • 385
  • 1
  • 6
  • 23

1 Answers1

0

Using BackupAgentHelper only uses the in-built Google backup system, and won't do anything useful for you if you don't have a Google Account on the device.

SharedPreferences files are just regular files in your app's data directory. If you want to copy them to the SD card, or your own server, on command, you can do that using the normal File API. It sounds like for what you're trying to achieve, it might be easiest to just call Context.fileList() to get an array of files in your apps' internal storage, and then iterate over that array, copying each file to a folder on the SD card.

Dan Hulme
  • 14,779
  • 3
  • 46
  • 95