Supporting offline access in an app is a common pattern. Usually, it is done by persisting remote data locally and, if no Internet connection is available, local data is then fetched instead.
We will add offline access support in our application by following through the next two chapters.
This chapter will focus on the means to store data locally. For this, we will use the local SQLite database and, to access it, we will utilize the StorIO library. StorIO provides a fluent interface to SQLite and readily supports RxJava. At the time of writing, the library only supports RxJava 1.0, so our knowledge of how to plug in the old version of RxJava will come in very handy here.
In this chapter, we will focus only on the means of writing data, while the next chapter will focus on reading it.
Finally, before we start working with StorIO, we will cover Schedulers and how to use them in Android to avoid the dreaded "Wait-or-kill" notification.
To summarize, the topics covered here will be as follows:
- What are Schedulers?
- What types of Schedulers are there and how are they different?
- What is the StorIO library?
- How to set up StorIO?
- How to use it to write data to the SQLite database in a reactive way?