question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

androidx.datastore integration

See original GitHub issue

The Android team is quietly working on a SharedPreferences replacement called datastore. It’d be nice to have a module that wraps that, once it’s ready. An interesting wrinkle is that it has fully coroutine-based APIs so it’s going to be non-trivial to wrap with the existing Settings interface.

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:2
  • Comments:8 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
russhwolfcommented, Nov 30, 2020

My current thinking is to have both FlowSettings and SuspendSettings interfaces, and converters between them and the standard Settings and ObservableSettings. Any Settings implementation can be wrapped to SuspendSettings pretty easily, but FlowSettings can only wrap around ObservableSettings because you need to set a listener to be able to get new updates in its Flows. There would be DataStore implementations of both, so you could use the one that fits your use-case better depending on what other implementations you need interop with.

I want to have a version of this ready in the near future as part of 0.7

1reaction
russhwolfcommented, Nov 9, 2020

Flow would be nice (there’s a prototype in #37 of wrapping flows around the existing listeners) but I’m leaning toward suspend fun by default so that commonality with non-observable implementations (in particular, JS) is easier. Still need to do more thinking and prototyping though.

Read more comments on GitHub >

github_iconTop Results From Across the Web

App Architecture: Data Layer - DataStore - Android Developers
Jetpack DataStore is a data storage solution that allows you to store key-value pairs or typed objects with protocol buffers.
Read more >
New way of storing data in Android — Jetpack DataStore
The new way of storing data in Android — Jetpack DataStore ... It can be integrated with LiveData , RxJava , and Coroutine...
Read more >
Deep Dive Into Preferences Datastore in Android
Google introduces Datastore as a replacement for shared preferences. Datastore is a data storage solution for storing small datasets in ...
Read more >
Jetpack DataStore in Android - GeeksforGeeks
Jetpack DataStore is a data storage solution that uses protocol buffers to store key-value pairs or typed objects. DataStore stores data ...
Read more >
Saving Data on Android, Chapter 5: Jetpack DataStore
DataStore is Google's new library to persist data as key-value pairs or typed objects using protocol buffers. Using Kotlin coroutines and Flow as...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found