Safely Migrating to DataStore in Production
summary
How to migrate Android apps from SharedPreferences to Jetpack Preference DataStore: create a singleton DataStore (Hilt recommended), provide a repository interface, and convert consumers to Kotlin Flow or offer Java-compatible wrappers (Rx/blocking). Perform key-by-key migrations using the SharedPreferences migration with a specific key set, test real upgrade paths and duplicate-key handling, and avoid large one-shot releases because reverting a migration can silently drop preferences written after migration.
AI-written summary · about
chapters (8)
- 0:00Introduction
- 0:21DataStore overview
- 3:55Migration motivation
- 8:32SharedPreferences vs DataStore
- 9:16Migration steps
- 15:19Java calls handling
- 20:15Testing before and after
- 25:31Summary
related talks
30mDataStore Preferences and migrating from SharedPreferences
19mJetpack DataStore - protocol buffers storage solution
27mSharing my preference for DataStore
25mThe New Modern Data Persistence on Android - Meet Jetpack Datastore
26mMigrating an app with millions of users progressively
18mRescuing Old Code with JetPack
29mReal World Kotlin-Powered Android
34mStoring app data reliably & performantly with SimpleStore
