Firebase on Android: Real-time Database and Cloud Storage

Looking to dive into Firebase Database and explore cloud storage tools? In this course, you'll develop an understanding of how to save data to a real-time database and upload files to a personalized cloud storage directory.
Course info
Rating
(26)
Level
Intermediate
Updated
Nov 20, 2017
Duration
2h 3m
Table of contents
Description
Course info
Rating
(26)
Level
Intermediate
Updated
Nov 20, 2017
Duration
2h 3m
Description

At the core of modern mobile application databases and storage systems is a thorough understanding of Firebase. In this course, Firebase on Android: Real-time Database and Cloud Storage, you'll learn how to seamlessly integrate Firebase into your Android projects. First, you'll discover how to create, retrieve, update, and delete data from the database. Next, you'll explore how to upload files to cloud storage. Finally, you'll learn to retrieve files in cloud storage. When you’re finished with this course, you'll have a foundational knowledge of the Firebase Database and cloud storage tools that will help you as you move forward to develop mobile applications. Software required: Android Studio 2.3.

About the author
About the author

Mitch's passion is teaching. He believes the current education system is outdated and you shouldn't have to spend your life savings to learn about the tech industry.

More from the author
Android Threads: Getting Started
Intermediate
2h 19m
Nov 15, 2018
Firebase on Android: Cloud Firestore
Intermediate
2h 14m
May 16, 2018
More courses by Mitch Tabian
Section Introduction Transcripts
Section Introduction Transcripts

Course Overview
Hi, my name is Mitch Tabian, and welcome to my course, Firebase on Android Real-time Database and Cloud Storage. I'm a self-employed Android developer, and I'm here to teach you about two incredible developer tools, the Firebase Database and Firebase Cloud Storage. Like other Firebase tools, the database and Cloud storage are fully integrated with Android Studio and are extremely easy to set up. Inserting data and uploading files can be done in less than 10 lines of code. Additionally, every Firebase task is automatically run on a background thread, so you don't have to worry about managing an async task, a handler, or a thread. Some of the major topics we'll cover include inserting data into the database. In the course, we'll create custom Java object classes and insert them directly into the database. Retrieving data from the database. We'll retrieve user information and display it in a custom profile. In the chat portion, we'll retrieve messages and display them in a chatroom. Uploading files to storage. Users will have the ability to upload a profile image. The profile image will be selected from the phone's memory or they can take a new one using the phone's camera. Once the image is uploaded to Firebase Storage, a download URL will be saved in the database. Real-time chatrooms. Users will have the ability to create or join chatrooms. All messages in the chatrooms are displayed in real-time. By the end of this course, you'll have an excellent understanding of two fundamental components of every mobile application, a database and a file storage system. You'll be able to apply your skills to new Android projects, or integrate with existing ones. Before beginning the course, you should be familiar with Android Studio, but I'll guide you through everything, so even if you're fairly new, you should be okay. I hope you'll join me on this journey to learn about Firebase with the Database and Cloud Storage course, at Pluralsight.

Integrating the Firebase Tools with Android
In this module, we're going to get started integrating the Firebase database into our Android project. For the duration of the module, we'll be working with the Source Code files in the directory module_2\start\TabianConsulting. As I mentioned before, the course preceding this one is Firebase on Android Email Authentication and Verification. We'll be continuing from the end point of that course and working on the Tabian Consulting application. If you've watched that course, then you can skip this section and move on to the section named, Syncing the Android Project with the Firebase Project. We're going to be working with Android Studio Version 2. 3 and Android Version 26, which is otherwise known as Android Oreo or Android O. To use Firebase with Android Studio, we're required to install the Firebase SDK and Google Play Services SDK. We need to take a quick look at the SDK Manager in Android Studio to make sure you meet all the requirements, and since we're going to be looking at the SDK Manager, we might as well open the project. Once you've downloaded and opened the project in Android Studio, you're ready to proceed. Let's navigate to the SDK Manager and see if we meet all of the dependency requirements. To navigate to the SDK Manager, click on Tools, Android, and select SDK Manager. First, make sure you have Android O installed, if it isn't, simply check the checkbox for Android O and click Apply. Next, take a look at the SDK Tools. Here we need to make sure that Google Repository is installed under Support Repository, and Google Play Services is also installed. If they aren't, simply check the checkbox and click Apply. That's all we need to do to start using Firebase. Also note that if you're going to be using the Emulator Accessory Application, ensure that it's updated. You can check that by viewing the status here. If it says it needs an update, just click the checkbox and hit Apply. In the next section, we'll head over to firebase. google. com and get started connecting our Android application to the Firebase servers.

Reading Data from the Database
In this module, we're going to read data from the Firebase database. For the duration of this module, I'll be referring to the Source Code files in the Directory module_4\start\TabianConsulting. Remember to add your Google Services JSON file to the Source Code. If you try to use mine, your application won't be able to communicate with the Firebase servers. This module will serve as an introduction to the more difficult topics covered later in the chat portion. I'll showcase the various ways you can read data and their respective purposes. To get more specific, we'll be working on reading the data in Settings Activity and displaying it in the application. Some key objects, interfaces, and methods you want to pay attention to are, the DataSnapshot object, a query object, the ValueEventListener interface, the addValueEventListener method, and the addListenerForSingleEvent method. Don't worry if you have no idea what those things are right now. It will all make sense shortly. I'll also talk about one thing that Firebase is missing in terms of a way it queries data from the database. In my opinion, it's pretty crucial, and there are some third party tools available that you can use to fill in the gap in functionality. In the next section, we'll take a look at Settings Activity and begin building the methods required for reading data from the Firebase database.

Implementing a Real-time Chat System
In this module, we're going to build a real-time chat system so we can showcase all the functionality we've been working on. For the duration of the module, I'll be referring to the Source Code Files in the Directory, Module_6\start\TabianConsulting. Remember to add your Google Services JSON file to the Source Code. If you try to use mine, your application won't be able to communicate with the Firebase servers. So far in this course, we've done a lot of coding, but we haven't added a lot of features to show for it. We can save and edit data in the Firebase database, and we can upload and display images, but that's about it. By the end of this module, users of the Tabian Consulting app will be able to create new chatrooms, add security restrictions to chatrooms, and send messages in real-time to other employees. Let's demo the fully functional version so you have an idea of what we'll be building. To access the chat portion of the app, we just click on the Menu icon and choose Chat. Once in the chat section, we can either join an existing chatroom or we can create a new one. Since we don't have any chatrooms, let's create one. We have to give it a title and a security level. The title can be anything. I'm just going to call this one new chat. The security system on the chatroom is pretty simple. Users with a security level lower than the chatrooms won't be able to join it, so if I create a chatroom with a security level of 5, only those with a security level of 5 or higher will be able to join it. I'll just give it a security level of 1 since that's my current security level. Cool. There's our new chatroom. Now, obviously, it's going to be pretty lonely in here since there's no other users, but if I wanted to test it, I can make another account and then join the chatroom. In the next section, we'll start building our real-time chat system by coding the functionality for creating new chatrooms.