Zubin Kadva
Zubin Kadva

Reputation: 601

Android: Safe and secure place in internal storage to backup my app data

I want to backup my app data. I have tried Android's BackupAgent, but it seems to be quite unstable and does not work for some devices.

So, I would like to instead backup my app data to internal storage. Thus, I require a safe location where I can backup my data.

Note: I would not like to backup data to external storage since the SD might not always be available.

I would like some suggestions please.

Upvotes: 0

Views: 265

Answers (2)

Zubin Kadva
Zubin Kadva

Reputation: 601

I ended up storing my local backup using:

Environment.getExternalStorageDirectory() + File.separator + "Android" + File.separator + "data" + File.separator + ".backup" + File.separator

I had to change the folder name since,

Android deletes the respective package from /Android/data/ when the app is uninstalled

Moreover, I prepend the folder name with a . so that it remains hidden.

Upvotes: 0

barq
barq

Reputation: 3711

Since Android 6 there is a Backup API. See http://developer.android.com/training/backup/autosyncapi.html

Upvotes: 1

Related Questions