android-jetpack-datastore Questions

7

Solved

i've been using jetpack datastore for a while, but then i got a problem. I want to clear data in datastore when the app is destroyed. Im using jetpack datastore to persist data only in form i've se...
Nonaggression asked 16/11, 2020 at 1:59

2

For Retrofit, Room we just call viewModelScope.launch { ... } and they automatically do requests in background thread But when I tried to update the model in DataStore it didn't work, though there ...
Breathed asked 11/8, 2022 at 19:50

2

Performing a migration from SharedPrefs into DataStore is straightforward and documented very well. However when I want to do a simple "version bump" migration from DataStore to still Dat...

3

Solved

I can only find ways to implement datastore through Kotlin. I have tried creating it with DataStore<Preferences> datastore = new Datastore<Preferences> but as soon as proceed with it, i...

7

Solved

I want to store some preferences using DataStore. But the problem is that my application can have multiple users and therefor needs to store these preferences in separate files. I got a working exa...

4

Solved

In jetpack datastore, you have to set the gradle plugin task for generating class out of .proto files: // build.gradle protobuf { protoc { artifact = "com.google.protobuf:protoc:3.10.0"...
Cassiterite asked 12/11, 2020 at 20:5

3

Solved

I followed this codelab from the android developer platform: https://developer.android.com/codelabs/android-proto-datastore#4 Added the same exact dependencies as shown in the codelab and I get the...

4

Solved

I was trying to provide a common DataStore<Preferences> so that the same preference file could be used in multiple places but I got the helpful error message: Cannot find symbol: DaggerMyApp...
Stockroom asked 11/12, 2020 at 13:47

1

I have created a composable called ResolveAuth. ResolveAuth is the first screen when user opens the app after Splash. All it does is check whether an email is present in Datastore or not. If yes re...

1

Solved

I try to give the user the choice whether to use the UI Mode 'light', 'dark' or the 'system' settings. I would like to save the selection as DataStore. The drop down menu for the user selection is ...

1

Solved

I was checking the execution time of datastore and shared preference and I observed that datastore takes more time than shared preference. This is my code suspend fun saveUser(user: User, context: ...

0

The core problem is that I want to set default values for child messages. Since proto3 doesn't allow the setting of default values in the proto file. Example Protobuf message Person { int32 age = ...
Glassy asked 17/3, 2022 at 16:31

1

Solved

I'm writing a jetpack compose android app, I need to store some settings permanently. I decided to use androidx.datastore:datastore-preferences:1.0.0 library, I have added this to my classpath. Acc...

1

As there is a Memory Exception when Shared Preferences data cross 1428.51-kb would it be the same memory constraints for the recommeded Android Jetpack DataStore? Since DataStore uses typed objects...
Undertaker asked 14/10, 2021 at 6:19

1

Solved

java.lang.IllegalStateException: There are multiple DataStores active for the same file: /data/user/0/com.firstgoalkeeper.firstgoalkeeper/files/datastore/player_pref.preferences_pb. You should eit...

4

Solved

I've read about new library from Jetpack (now in alpha) - Jetpack Datastore. It's clear from documentation that it's a sort of Shared Preferences' killer Jetpack DataStore is a data storage soluti...
Phalarope asked 23/9, 2020 at 21:45

1

i have a situation that I get resolved with SharedPreferences. But now I'm migrating to kotlin and DataStore. I faced this problem. I have a String value stored in shared preferences, among other k...
Malaco asked 2/3, 2021 at 15:56

1

Is it possible to just read/write primitive types from a DataStore? For example, I just want to read an Int. I do not want any Flow wrapped around it. Just plain Int.
Sunn asked 26/4, 2021 at 11:40

1

Solved

I'm trying to get myself familiar with DataStore, so in my current project, I'm trying to use it. In my dependency. I've added : implementation "androidx.datastore:datastore-preferences:1.0.0...

1

Solved

I'm trying to use staticCompositionLocalOf in Jetpack Compose according to this article on Medium. This is my ProvidableCompositionLocal val lightColors = lightColors( primary = LightColor.Backgro...

2

Solved

So with the new alpha07 version, Android ditched the private val dataStore = context.createDataStore(name = "settings_pref"), however the new way they use datastore doesn't work for me. S...

2

I try to store & get data using a datastore-preference alpha07, everything working fine, I got some memory leak issue in the datastore What's the best practice to prevent memory leaks using Dat...

1

Am I missing something or is it not possible to attach a listener to the new Android Jetpack Preference Datastore? I thought the whole point of using Flow is that we can call flow.toLiveData() on t...
Bedevil asked 12/10, 2020 at 4:35

5

Solved

EDIT: I NEED TO PASS A CONTEXT AS A PARAMETER TO THE CLASS (DataStore and repository is the same class, don't get confused) I have two activities, A and B and one repository. Activity A opens activ...
Tamikatamiko asked 11/2, 2021 at 9:3

3

Solved

I had previously replaced SharedPreferences in my app with the new DataStore, as recommended by Google in the docs, to reap some of the obvious benefits. Then it came time to add a settings screen,...

© 2022 - 2025 — McMap. All rights reserved.