Your next career begins with
Save 50% off your seat in our next iOS Bootcamp. Limited time only. Sessions start April 3.
Saving Data on Android
Version history
Second Edition · Android 11, Kotlin 1.5, Android Studio 4.2 (Selected)
Aug 11 2021First Edition · Android 10, Kotlin 1.3, AS 3.5
Sep 18 2019A book that will teach you to persist data on Android by saving it locally or remotely. Also includes modern synchronization techniques, allowing your app to be reactive and always up-to-date. By Harun Wangereka, Subhrajyoti Sen & Fuad Kamal.
Sign up/Sign in
With a free Kodeco account you can download source code, track your progress, bookmark, personalise your learner profile and more!
Create accountAlready a member of Kodeco? Sign in
Sign up/Sign in
With a free Kodeco account you can download source code, track your progress, bookmark, personalise your learner profile and more!
Create accountAlready a member of Kodeco? Sign in
Sign up/Sign in
With a free Kodeco account you can download source code, track your progress, bookmark, personalise your learner profile and more!
Create accountAlready a member of Kodeco? Sign in
Who is this for?
This book is for intermediate Kotlin or Android developers who want to know how to persist data using the standard Android APIs, Jetpack DataStore, the Room Architecture Component or Google Firebase.
Covered concepts
- Persistence with Android SDK
- Saving data with Jetpack DataStore
- Using Room
- Manage relations with Room
- Managing and testing Migrations
- Firebase Realtime Database
- Cloud Storage
Persisting data has always been a fundamental part of any app. Saving data locally or remotely with modern techniques for synchronization allows your app to always be up-to-date, reactively presenting fresh data.
This book is for intermediate Kotlin or Android developers who want to know how...
moreSave Data on Android!
Persisting data has always been a fundamental part of any app. Saving data locally or remotely with modern techniques for synchronization allows your app to always be up-to-date, reactively presenting fresh data.
This book is for intermediate Kotlin or Android developers who want to know how to persist data using the standard Android APIs, the Jetpack DataStore mechanism, the Room Android Architecture Component or Google Firebase’s offerings.
Topics Covered in This Book
- Persistence with Android SDK: Learn how to manage files, SharedPreferences and SQLite databases using the APIs the Android platform offers by default.
- Jetpack DataStore: Learn how to persist simple data by using key-value pairs. This is Google’s new and improved solution for saving data. In this book, you’ll learn basics about Preferences DataStore and how to migrate from SharedPreferences.
- Using Room: Room is one of the most important Google Architecture Components. It allows you to manage entities and relationships using classic Object-Oriented principles. In this book, you’ll learn everything you need to store data and run queries on top of it.
- Managing relationships with Room: A database has entities and relationships. In this book, you’ll learn how to design your database and manage relationships both eagerly and lazily.
- Managing and testing migrations: Every app evolves over time. Here, you’ll learn how to manage migrations with Room and how to test them properly.
- Firebase Realtime Database: Google provides tools to manage data both locally and remotely through the Firebase platform. With the Firebase Realtime Database, you can manage and keep data in sync, simply and efficiently.
- Cloud Storage: Another option Google provides is Cloud Storage, which lets you leverage all the power of Google’s infrastructure to manage your data and run expensive queries.
Before You Begin
This section tells you a few things you need to know before you get started, such as what you’ll need for hardware and software, where to find the project files for this book, and more.
Saving Data Using Android SDK & Jetpack DataStore
Ready to learn all about how to persist data in your app? In this chapter, you’ll use practical examples to see how to use the API that Android SDK provides to persist data. You’ll learn when and how to manage persistence depending on the type and quantity of data.
Your main focus will be on storing data to Files, SharedPreferences and SQLite Database. You’ll also learn how to share data across multiple apps with ContentProvider.
Finally, you’ll learn how to use Jetpack DataStore, Google’s latest tool for handling data persistence. Along the way, you’ll see how to migrate from SharedPreferences to Jetpack DataStore.
Using Room
Architecture Components made their debut at Google I/O 2018. Google presented them as a set of solutions for the most common problems in the development of Android apps. Data persistence was among those problems, and one solution that Architecture Components offers is Room. In this section, you’ll learn how to use the Room library to persist data in your apps and how to safely migrate data after you change your database schema.
Using Firebase
Firebase is a mature suite of products that allow you to implement Android apps that persist information safely, securely and reliably. In this section, you’ll learn the fundamentals and more advanced concepts of Firebase, including how to read and write to Realtime Database, how to use it in offline mode and everything you need to know about its usage and performance. You’ll learn a few things about managing and securing data in Cloud Firestore. Finally, the last part of the section contains basics about Cloud Storage.
All videos. All books.
One low price.
A Kodeco subscription is the best way to learn and master mobile development — plans start at just $19.99/month! Learn iOS, Swift, Android, Kotlin, Flutter and Dart development and unlock our massive catalog of 50+ books and 4,000+ videos.
Learn more