Summary
In this chapter, we analyzed alternatives to Room when it comes to persisting data. We looked first at SharedPreferences
and how it constitutes a handy solution for data persistence when itβs in a key-value format and the amount of data is small. We also looked at DataStore
and how we can use it like SharedPreferences
but with built-in observability, which notifies us when values are changed.
Next, we looked over something that was continuously changing when it comes to the Android framework β the evolution of abstractions regarding a filesystem. We started with an overview of the types of storage that Android has and then took a more in-depth look at two of the abstractions β FileProvider
, which your app can use to store files on a device and share them with others if necessary, and the SAF, which can be used to save files on the device in a location selected by a user.
We also used the benefits of FileProvider
to generate URIs for files in order...