Chapter 7. Permanent Data
Even though Internet connection has improved quite noticeably in recent years and most mobile users have a data plan, there are always situations where we can't rely on mobile data. This is because either the user is in an area without network coverage or the user is not willing to pay for roaming costs, assuming that they are traveling to another country. In these situations, our application will benefit from having some data stored in the device itself to allow the user to work in, what we call, offline mode. With this, we will not only allow the user to do some work, but also greatly improve the user experience, as being able to store data on the device will reduce the time the application will take to display information.
In this chapter, we will explain different mechanisms to store data locally on the device: from how to store basic settings using SharedPreferences and writing internal and external files to how to use a SQLite database...