Get started with data persistence for Android apps. Learn about various options for storing your app's data in a database, including working with SQLite, Cupboard, and Realm.
- As developers, we aim to provide the best user experience possible in our applications. Often, our users may be offline or lose connectivity temporarily. With this in mind, we can provide a seamless experience for them by storing data locally on their devices. My name is Annyce Davis and I specialize in Android application development. For over a decade, I've been working in the software industry and I've come to love the power we have to transform lives through technology.
One of the challenging things about software development, however, is the wide array of options available to complete any given task. It's difficult to know which library or open-source solution would be best for your application. Data persistence is no exception. On Android, there are several ways that you can store your data. From device preferences, to file storage, as well as in a database. In this course, we're going to review various options for storing your application's data in a database.
First, we're going to look at using stock SQLite. This is the database that ships with Android out of the box. Next, we're going to explore cupboard, a SQLite abstraction layer. This is an open-source project dedicated to reducing the complexity of your SQLite interactions. And finally, we'll look at Realm, an object database solution. This library was designed from the ground up with mobile devices in mind.
I'm excited to share my experience with you and help you get started with persisting your data on Android.
To begin, Annyce Davis reviews using the de facto data persistence solution available on Android: SQLite. She takes you through basic SQLite concepts—such as how to create a database wrapper and insert data into a table—as well as a few more advanced topics. Next, she covers working with Cupboard, an open-source project dedicated to simplifying your SQLite interactions. To wrap up, she dives into working with Realm, an object database solution designed with mobile devices in mind. Throughout the course, Annyce discusses establishing relationships between database tables, creating and running queries, as well as performing data migrations.
- Overview of SQLite
- Defining a database table's schema
- Exploring SQLite create table syntax
- Executing create table statements
- Inserting data with a foreign key relation
- Inspecting the database using a terminal
- Updating and deleting records
- Working with Cupboard
- Working with Realm