Bagusflyer
Bagusflyer

Reputation: 12925

Android data persistency

I'd like to develop an app which need some data persistency. For some reason, I don't want to use database. And I'd like something similar to the shared preference. But only have one more requirement:

Are there any suggestions? Thanks

P.S.: In iOS, I use the keychain.It works perfectly.

Upvotes: 1

Views: 323

Answers (2)

Nick Cardoso
Nick Cardoso

Reputation: 21753

The only solution I can think of to ensure non-removal on uninstallation is to write a file somewhere on the external storage. However this is (a) insecure (b) prone to other issues such as users deleting it.

If you are worried about persisting data on upgrades then using a database with a ContentProvider you can achieve this fairly easily. Shared Prefs are only really meant for a small number of small values/primitives.

There is also the option of storing something remotely, with a web service if it fits with whatever need you have to retain data when uninstalled/reinstalled.

The majority of questions like yours indicate an issue somewhere else in the way your application is architected, if you provide more detail people here may give you a better solution

Upvotes: 1

Curtis Murphy
Curtis Murphy

Reputation: 304

The only way I can think of doing it is syncing the data with the cloud and restoring it if the user reinstalls the app. You may want to look at leveraging the BackupManager.

Upvotes: 0

Related Questions