I like to know if is possible to open a data store in adittion to create it.
Reading the official documentation, theres the mention about the extension function on Context class for creating a preference data store.
fun Context.createDataStore(name: String): DataStore<Preferences>
But, it creates a new data store, is possible to get a previously created one, like the previous implementation of SharedPreferences?
/* getting or creating a shared preferences instance */
context.getSharedPreferences("preferences_key", Context.MODE_PRIVATE)
Any help would be appreciated.
This was submitted to the google's issue tracker.
(UPDATE)
After applying the preferences data store, i noticed the following:
when using preferences data store, the data lives only when the app is opened and active.
I remember one thing that is mandatory when using the shared preferences:
They (the preferences) are saved until i unistall the app...
this is not happening when using the preferences data store.
I hope they'll fix that, understanding that is in alpha phase.