My data is simple property values so I could store either way, but I was wondering which is more reliable? Are shared preferences auto saved and therefore more reliable? Or because they are non-transactional is that less reliable?
The use of SharedPreferences or a ContentProvider/SQLite database is situation-based. In your situation, I would recommend using SharedPreferences
. A SQLite database is meant for potential hundreds of entries. SQLite database can also be queried and the data retrieval is much more robust. The SQLite database adds immense power to your entries. But in your case, I would recommend using SharedPreferences
, unless you have the unusual need to sort/filter through your property values. They are both reliable services, SharedPreferences
are not autosaved, you must use commit()
to save changes. The SQLite database is a lot more structured than SharedPreferences
. For more information check out docs.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With