It’s a bright, summer morning. ☀️
You’re an Android developer sipping on your coffee and building an Android app for your users.
You’ve spent the past few days laying down the foundations for your app. You’re now at a point you want to save user preferences and data.
You look up resources and forums on the Internet, and hear about all these libraries in Android that help you save user preferences and data—but you don’t know where to start. There’s so many resources, so many developers with so many opinions on what’s the best. Also, what new libraries do you need to learn?
You look out the window, and wonder, “Man, there are so many ways to persist data on Android. How do I do that for my app?” 🤔
Look! Up in the sky! It’s a bird! It’s a plane! It’s our book, Saving Data on Android! 📕
Yes, we’ve got a newly-updated book for you that helps you learn how to:
- Manage files, SharedPreferences and SQLite databases using the APIs the Android platform offers by default.
- Persist data with key-value pairs using Jetpack DataStore, Google’s new and improved solution for saving data, and how to migrate to this from SharedPreferences.
- Use Room, manage relationships in it and test migrations.
- Implement Firebase Realtime Database to manage and keep data in sync, simply and efficiently.
- Use Cloud Storage to use the power of Google’s infrastructure to manage your data and run expensive queries.
Introducing the super-book you deserve, Saving Data on Android!
Who Is This Book For?
This book is for intermediate 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 products.
What’s Inside the Book?
This revised edition of the Saving Data on Android book kicks off with the foundations of the standard Android APIs for data persistence, and then goes deep into Room and Firebase. Here are the sections in this book:
Section I: Saving Data Using Android SDK and Jetpack DataStore
In this section, you will learn how to:
- Use practical examples to see how to use the API that Android SDK provides to persist data.
- Manage persistence depending on the type and quantity of data.
- Store data to Files, SharedPreferences and SQLite Database—and share data across multiple apps with ContentProvider.
- Use Jetpack DataStore, Google’s latest tool for handling data persistence, and migrate from SharedPreferences to Jetpack DataStore.
Section II: Using Room
This section goes deep into the Room persistence library, which is a part of Architecture Components. You’ll learn how to:
- Use the Room library to persist data in your apps.
- Safely migrate data after you change your database schema.
Section III: Using Firebase
Firebase is a veteran when it comes to data persistence on the cloud. So, in this section, you’ll learn:
- Fundamentals and more advanced concepts of Firebase.
- How to read and write to Realtime Database, and use it in offline mode.
- How to manage and secure data in Cloud Firestore.
- Basics of Cloud Storage.
What Do You Need?
To follow along with this book, you’ll need the following:
- Android Studio 4.1+: Available at developer.android.com/studio. This is the environment in which you’ll develop most of the sample code in this book. If you didn’t install it already, now is the right time to do that!
- Java SE Development Kit 8+: Most of the code in this book will be run on the Java Virtual Machine or JVM, for which you need a Java Development Kit or JDK. The JDK can be downloaded from Oracle here.
- Kotlin Playground: You can also use the Kotlin Playground available at the Kotlin home page at play.kotlinlang.org.
Android 6.0+: The
minimumSdkVersionfor the projects targets API 23. Therefore, you need an emulator or device running API 23 or higher.
How to Get Your Own Copy
There are two ways you can get this book:
- Buy it individually: If you want to build up a custom library without a subscription, you can choose to buy the book individually. It’s available now for just $59.99 in our online store.
- Get it as part of our Pro subscription: Enjoy access to our videos and mobile development books in our Ultimate Pro subscription, including Saving Data on Android! Right now, you can get a full year’s subscription and save 20% off the cost of a regular monthly subscription. It’s simply the best investment for your development career.
We hope you enjoy this book! Feel free to reach out to us if you have any questions.
Say Hi to our Team! 👋
Meet the awesome folks who contributed to this book…
Fuad Kamal [Author]: Fuad Kamal is one of the authors of this book. Fuad provides mobile strategy, architecture and development for the Health, Fitness and Telematics markets. If you’ve ever been to an airport, you’ve likely seen his work—the flight arrival and departure screens are a Flash 7 interface he wrote near the beginning of the millennium. He’s also into photography. He’s @FlexRonin on Twitter and Instagram or you can contact him through anaara.com.
Subhrajyoti Sen [Author]: Subhrajyoti Sen is one of the authors of this book. Subhrajyoti is a Google Developer Expert for Android and an Android Engineer at KeepTruckin, where he develops apps to improve the trucking industry. Before this, he also worked on apps to improve the experience of Indian investors. He believes in the power of Open Source and communities and actively tries to give back. When not writing code, you can find him binge-watching anime, reading up on public policy or playing Rocket League.
Harun Wangereka [Author]: Harun Wangereka is one of the authors of this book. Harun is an Android Developer who is passionate about creating quality Android apps. He never tires of learning, building the tech community and helping other developers upscale their skills. He loves contributing to open-source projects and writing technical articles on the topics of Android and Kotlin. He’s very passionate about giving back to the community and sharing his knowledge and experiences.
Gabriela Angebrandt [Final Pass Editor]: Gabriela Angebrandt is the technical and final pass editor of this book. Gabriela is a tech enthusiast with a master’s degree in Computer Science who specializes in Java, Kotlin and Swift. She is an Android and iOS developer at Code Consulting Ltd. She got into programming during college and has been developing apps for several years. Her passion for sharing knowledge drives her to contribute to the developer community through books and articles. In her spare time, Gabriela attends tech talks and invests time to learn new things from the programming world. When she’s not crushing it in the tech world, she enjoys spending time with her horse and cat, rock climbing and playing the piano.
Sandra Grauschopf [Editor]: Sandra Grauschopf is the language editor of this book. She is a freelance writer, editor, and content strategist as well as the Editing Team Lead at raywenderlich.com. She loves to untangle tortured sentences and to travel the world with a trusty book in her hand. You can follow her on Twitter at @sgrauschopf or learn more about her at grauschopf.com.
Start Reading for Free Today
This revised edition of Saving Data on Android is out today—and even better, you can start reading the book for free:
Just like our other Pro books, Saving Data on Android has been automatically added to the collections of all Ultimate Pro subscribers.
On behalf of the book team, we hope this book helps you persist data for your Android apps, and you enjoy learning everything it has to offer!