Я использую хранилище данных в своем p, но не могу понять, как получить многопроцессную версию.
Это текущий код, который создает хранилище данных:
private const val DATASTORE_NAME = "cross_process_prefs"
private val dataStoreScope = CoroutineScope(SupervisorJob() + Dispatchers.IO)
private val dataStore: DataStore = PreferenceDataStoreFactory.create(
corruptionHandler = ReplaceFileCorruptionHandler { emptyPreferences() },
scope = dataStoreScope
) {
context.applicationContext.preferencesDataStoreFile(DATASTORE_NAME)
}
The is what I have in my gradle file:
implementation("androidx.datastore:datastore-preferences:1.2.0")
implementation("androidx.datastore:datastore-core:1.2.0")
implementation("androidx.datastore:datastore-preferences-core:1.2.0")
I have tried what is in the Android doc but can't figure out exactly what to put in each field and can't get any of ChatGpt/Grok/Gemini to help me.
I have been going round in circles and gotten nowhere
Подробнее здесь: https://stackoverflow.com/questions/798 ... sdatastore