In Android apps, you can store user settings, like language, using SharedPreferences API. SharedPreferences runs its read/write operations on the UI thread. This can block the UI thread, becoming a source of ANRs(Application Not Responding).
Jetpack DataStore is the new and improved data storage solution. It allows you to store key-value pairs or typed objects using protocol buffers. It is built on Kotlin Coroutines and Flow. Hence, data is stored asynchronously, consistently, and transactionally, overcoming some of the limitations of SharedPreferences.
In this session, I'll go through Jetpack DataStore. I'll go over the two implementations: Preferences DataStore and Proto DataStore, as well as how to migrate SharedPreferences to DataStore. Goodbye ANRs 😀.