This is part of the Advanced Android Data & Networking learning path. View path.
Who is this for?
Intermediate level Android developers who want to learn about the new Android Jetpack DataStore API. This course will be particularly useful if you want to learn more about how to save data in Android.
- Storing Simple Key-value Pairs
- Storing Complex Data
- Migrating Existing Data
- Protocol Buffers
Part 1: Android DataStore
Learn how to implement a theme change functionality by storing the current theme in SharedPreferences. Also prepare to develop other parts of the app by enabling auto import in your settings.
Jetpack DataStore is a solution for data persistence that lets you store key-value pairs or typed objects by using protocol buffers. In this episode learn all you need to know about DataStore and the advantages it provides over SharedPreferences.
In the previous episode we stored our theme’s information in SharedPreferences. While this is fine in most cases it is not using DataStore and our course is all about DataStore, right? In this episode start migrating our information to Jetpack DataStore.
Now that you have created your Prefs Datastore it is time to use it. In this episode learn how to read and observe data from Prefs DataStore using your ViewModels.
In this episode, learn how to observe data from Prefs DataStore using your ViewModels.
Reading and observing data from Prefs DataStore is fine but we still need to be able to save information. In this episode learn how to write data to DataStore.
Proto DataStore uses protocol buffers to serialize data. Protocol buffers are Google’s language-neutral and platform-neutral mechanisms for serializing structured data. In this episode start implementing filtering with Proto DataStore.
Create a Serializer
In order to let DataStore know how to read and write the data type you previously defined, you will need a Serializer. In this episode, create a Serializer for your filter_options.proto file.
Read Filter Options
Now that your Proto DataStore is ready you need to start using it. In this episode learn how to read the filter options saved in DataStore.
In the last episode of this course add the code to react to filter changes and update the UI accordingly.