~/talk

DataStore Preferences and migrating from SharedPreferences

Talkat droidcon Berlin 2021 · 2021-10-20..10-22· [android]
links:none on file
slides:none on file

DataStore replaces SharedPreferences for small key/value needs, using Kotlin coroutines and Flow on Dispatchers.IO to avoid UI blocking, and signals IO errors instead of failing silently. Two implementations exist: Proto DataStore (typed via protocol buffers, schema in app/src/main/proto, file like settings.pb, serializer + builder API) and Preference DataStore (simple key/value). A provided shared preferences migration helper and customizable mapper move legacy keys into the new store; production migrations report seamless results when mapper code is correct. Version noted: data-store-core 1.0.0.

AI-written summary · about

  1. 0:00Introduction and agenda
  2. 1:51Why replace SharedPreferences
  3. 5:04DataStore benefits overview
  4. 8:42Setting up DataStore
  5. 10:26Preference DataStore basics
  6. 12:55Proto DataStore setup
  7. 13:39Defining Proto schema
  8. 16:16Proto DataStore operations
  9. 19:21Migrating from SharedPreferences
  10. 22:36Simple key-value migration
  11. 24:00Proto DataStore migration
  12. 27:12Synchronous access methods
  13. 28:58Summary and future outlook
  14. 30:21Q&A
~/search
type to search 6,249 conferences, 138,987 speakers and 185,172 talks
~/help
cmdctrl k
search every conference, speaker and series
/
focus the filter search
h
home
c
conferences
s
speakers
e
series
t
light / dark — the status bar button does the same
?
this help
esc
close this, then clear every filter — or just the search, while you are typing in it

Ignored while you are typing. Pages without a filter rail have no search to focus.