Session

Jetpack DataStore

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 😀.

Beatrice Kinya

Android Engineer | Google Developer Expert for Android

Actions

Please note that Sessionize is not responsible for the accuracy or validity of the data provided by speakers. If you suspect this profile to be fake or spam, please let us know.

Jump to top