I'm prototyping a new greenfield app in Compose. I...
# getting-started
t
I'm prototyping a new greenfield app in Compose. I'm a little unclear on whether SharedPreferences is still the way to keep track of app specific settings. I've used it to that end before, but then I see references to Jetpack Preferences. But that seems more like a UI framework for a settings screen. I just want to persist 3 keyed booleans that get set while a user uses the app, so that when they run it again, those are the default values
e
https://developer.android.com/topic/libraries/architecture/datastore is the jetpack substitute for sharedpreferences
but it's not the only possibility; there's other projects like https://github.com/russhwolf/multiplatform-settings
plus1 3
s
regarding Multiplatform Settings:
Copy code
The Settings interface has implementations on the Android, iOS, macOS, watchOS, tvOS, JS, JVM, and Windows platforms.
What about Linux?? It feels like an odd platform to leave out. (also it's the one I'd need 😅) Maybe it's just not mentioned??
m
If i am not mistaken macOS, Windows and Linux can all use the JVM implementation.
e
the JVM implementation uses java.util.prefs.Preferences#userRoot() which is provided by the JVM itself, usually backed by some platform-specific storage