Question Details

No question body available.

Tags

android android-development passwords

Answers (2)

August 26, 2025 Score: 1 Rep: 139,686 Quality: Medium Completeness: 70%

Of course I don't want to implement a cloud backup here.

Why not?

What is the best way to locally and securely backup the data of passwords only so that upon reinstalling the app and logging back in the data since backed up , it won't be lost.

Cloud backup.

While an app can store stuff in a dataset in shared storage (see Ewan's answer), I'm not sure it's a good idea to use that for the backups, for two reasons:

  1. Things happen: apps get uninstalled and devices get lost, stolen or broken. And when somebody gets his smartphone stolen, the last thing he needs is an additional headache about all his passwords being definitively lost.

  2. If you discuss with your users, there is a strong chance that they would want not just a backup, but background synchronization. If I create a password on my tablet, I am expecting to see it on my smartphone as well, automatically.

August 26, 2025 Score: 1 Rep: 85,137 Quality: Medium Completeness: 70%

Vibe coding here, but..

You can save files to one of the shared storage locations, or external storage.

https://developer.android.com/training/data-storage/shared/documents-files

This wont be deleted if the app is uninstalled. But presumably you will want to encrypt the file and so you have the same problem with the encryption key

You do mention logging in and accounts, so do you store the encryption key in the cloud?

If so then on a reinstall the user can log into their account, download the key and decrypt the file from shared storage.

But your question had three parts. The backup must be :

  1. The BEST
  2. Local
  3. Secure

I'm just "vibing" here as the kids say, so I don't know if this is the "BEST" the downside is that other apps will be able to access the file. You are giving up on the OS security for app only access to its own data.

Tick the local requirement. But this wont stop users deleting it or factory resetting their phones.

It's less secure than using the app specific storage. You will have to weigh that against it not being online.