I'd like to know if it's a good idea to create my app with SharedPreferences while it has been depreciated. It's really sad, it was a very simple and elegant way to save small paramters, I read about Preference Datastore but it seem very complicated compared to it. If I still use SharedPreferences does it mean that my app is obsolete for new androids version? And what is the best alternative to it?
Thanks
CodePudding user response:
SharedPreferences is not deprecated.
Preference (the settings screen UI element) and PreferenceManager are deprecated in favor of the Jetpack Preferences library, which works almost exactly the same way and still uses SharedPreferences directly.
Import androidx.preference:preference:1.1.0
in your dependencies and import the androidx
version of PreferenceManager and PreferenceFragment to use it without deprecation warnings.