Firebase for Android Development
- 2.5 hours on-demand video
- 1 downloadable resource
- Full lifetime access
- Access on mobile and TV
- Certificate of Completion
Get your team access to 4,000+ top Udemy courses anytime, anywhere.Try Udemy for Business
- Identify Firebase backend solutions that get your app connected to the cloud
- Build a scalable cloud database that can work in real-time as well as offline
- Create a system to validate users and allow their data to be synced across their different devices
- Store large files such as images on cloud storage connected to your database
- Leverage the power of analytics to log events and find out what features are being used most by your users
- Split users into segments to target them with push notifications they need and give them an improved in-app experience.
- Conduct different user and device tests and pinpoint the cause of bugs in your app
Before setting up a database in an app, one must know what they are creating. This video will show viewers the database structure we’ll be creating in the following videos.
• Know about Firestore’s document-structured model
• Know what collections and documents are
• Create the actual data model
In order to provide a log-in interface for our users, we can use Firebase Authentication to provide us with that and let it handle most of the background tasks that would normally take hours off of a developer’s time.
• Gain an overview of Firebase Authentication
• Understand Firebase Authentication
In our data model, we decided we wanted to store data that belongs to a user by storing it under their userID. We’ll get this userID by allowing our users to sign into our app and use FirebaseUI to provide a ready-made fully-optimized login screen.
• Import the FirebaseUI dependency
• Create a signInIntent with AuthUI, passing a list of providers
• Add a log out button in the menu
We’ll be wanting to store our user’s data on a cloud database so that their list items can be saved and synced across different devices through their account. This video shows how Cloud Firestore gives us a pretty nice way of doing so.
• Gain an overview of Cloud Firestore
• Understand Cloud Firestore
In this video we will read and write to and from our database, but we lack a way to delete our list items. We fix that here by creating a custom adapter with a dedicated delete button.
• Create the list item layout and custom adapter.
• Add an onClickListener to the delete button in the adapter
• Delete the item from the list and recreate the hashmap to upload again
An unprotected database is a very frail one. We’ll learn the ways of database security as we learn how to write our own security rules for the database.
• Learn about the match and allow functions
• Access pre-defined variables such as request and resource
• Understand hierarchical data and wildcards
Integrating multiple Firebase services can often lead to a few common mistakes
• Create a menu to provide a way to log out
• Stop addListListener from being called when not authenticated
• Call initFirebase again when the user signs in
Right now, our apps looks, well, plain. We’ll take a little break from the pace of development as we focus on the design of our app.
• Style the list items and add a divider
• Use the AndroidBootstrap library to design the button
• Use the ExpandableLayout library to design the insert-item field
This video aims to show how to upload files. 3 methods are available to Firebase Cloud Storage for uploading, and we’ll pick one with reasoning and show how to use that.
• Pick the upload method to use
• Copy the file into the app’s directory and get its URI
• Create a StorageReference and call putFile
On top of the same problems with uploading files (multi-method choice), we must make checks to see if the file already exists in local storage so we don’t have to tap into the network each time we want to see the image.
• Make checks to see if file is in local storage
• Pick the download method to use
• Create the StorageReference and call getFile
Just like with the database, we want to protect our files from hackers. The security rules for Cloud Storage are very similar to Firestore’s, but there are some subtle key differences which can catch many off-guard.
• Go over key difference in the match statement
• Go over desired pre-defined variables
Every app needs some sort of Analytics integrated to understand its users and progress well. We’ll gain an understanding of how Firebase Analytics does that as well as how it excels in certain fields.
• Gain an overview of Firebase Analytics
This video aims to present all the tools of Firebase Analytics many of which are ignored and heavily underestimated. We go into what each tool is used for and when to use them.
• Identifying the data in the Analytics main dashboard
• Getting familiar with each Analytics tool
Firebase does set up pre-defined events we can see in our Events tool of Analytics, but we can leverage this tool even further by logging our own events so we can observe exactly how our users are using our app.
• Initialize Firebase Analytics
• Log the event as a bundle of key/value pairs
• Enable debug mode if required
One of the key aspects of Firebase Analytics is user segmentation: a way of defining users into grouped segments so that we can utilize the full potential of other Firebase services including Cloud Messaging, Remote Config, and A/B Testing.
• Gain an overview of User Segmentation
One of the more powerful tools of Firebase Analytics is the ability to define user segments. We can use these to observe how many of our users fall into certain categories, or to target them with features like Cloud Messaging and Remote Config which we’ll be doing later on.
• Add the user property in the Firebase Console
• Set the user property in the app’s code
• Create audiences in the Firebase Console to observe and target
Now that we know about Cloud Messaging, we need to learn how to use it. The most basic and straightforward way is to send messages manually using the Firebase Console.
• Import the Cloud Messaging dependency
• Create the services that will allow the device to receive the messages
• Go to Cloud Messaging in the Console to access the Message Builder
Using the Console to send messages is great when we want to manually pass on information and updates, but that’s not very versatile. Cloud Messaging has a few other applications that greatly expand its array of uses.
• Learn about the different applications of Cloud Messaging
We need to create parameters to store locally on the device as well as on the cloud as well as set the different configurations for each user segment.
• Create configdefaults.xml which includes each parameter and their default values
• Create the parameters again in the Console and add their different configurations
• Create the fetchParameters method
Since Remote Config is really just being able to manage a key-value pair stored on the cloud, it is very versatile. We’ll learn about some of these different uses to grasp Remote Config’s fullest potential.
• Recap on how we’ve already been using Remote Config
• Learn about how Remote Config can be used to slowly roll out an update
• Learn about A/B Testing and its stems from Remote Config
We need our function to trigger when the user first logs in. Unfortunately, we can’t use authentication’s trigger directly because we only want to trigger on the first time a user logs in, so we’ll explore a roundabout way of doing things
• Use npm to install the Firebase CLI and initialize the functions folder
• Use Firestore to store a messaging token
• Create the sendWelcomeMessage function trigger
Now that we have our trigger, we can start filling out our function to send our users a welcome message when they first log in using Cloud Messaging.
• Compare Firestore data and get the messaging token
• Construct the message payload and send the message
• Deploy the function using the Firebase CLI
Crashlytics is Firebase’s crash reporting service, and it would be a mistake to develop or produce an app without one. The amount of time it can save is invaluable with the ability to pinpoint the exact location of a crash or gather information leading to it.
• Enable Crashlytics using the Fabric plugin
• Import the Dependencies
• Test it by forcing a crash
Crashlytics offers a lot already in its default setup, but there are ways to leverage it even further. With a little extra code, we can go even further into that debugging time saving.
• Add logs, key-value pairs, and UID data to precede an expected crash
• Review this data on the Firebase Console
• Log non-fatal bugs with Crashlytics.logException
There are so many different Android devices our users could potentially be using. Testing for even a good percentage would normally be a huge pain. With Test Lab however, we can utilize Google’s lab of devices and test our app on them.
• Gain an overview of Firebase Test Lab
A Robo Test is an automated test that scans rapidly through our app. We’ll learn how to run one efficiently so that we can gain some insight about how our app runs on different devices.
• Build an APK and upload it to the Firebase Console
• Run the test on a selection of devices and versions.
• Once complete, review the test and check for any errors
We might want to gain some insight about what our users want in our app. An A/B Test will allow us to serve different configurations to different groups of our users and analyze different metrics including user engagement and retention.
• Create the test in the Firebase Console
• Set the different variants and their configurations
• Set a goal and other metrics to track
We’ve completed everything. We know now how to integrate a majority of Firebase’s different tools and services, and we now also have our finished value list. We’ll close up by going through a quick recap of how we’ve done everything thus far.
• Go through a recap of what we’ve done
• Celebrate good times
- Developers taking this course need to have a basic understanding of building apps with XML and Java.
Building a successful app needs a backend platform to store your users' data, which is taxing and inefficient if you try to create your own. There are so many devices that would take you forever if you tried to test your app on them. You will waste time fixing bugs affecting your app and it's almost impossible to tailor your app to each user's needs.
This course starts by explaining the features and benefits of using Firebase as a backend. Firebase is a seamless way to connect your app to the cloud. This way, your app can access its various tools and services—for example, its databases (to create an easy backend) and its crash reporting services, to save you plenty of time debugging. This course will help you build a to-do list application that rewards users with value points for completing tasks, allowing them to reap rewards such as special features as they get more tasks done. You'll also be able to access a PC version of the app to add and remove items, which will update on all platforms in real-time. You'll even be able to send alerts from the PC to the Android version of the app, even if the app hasn't yet been opened on Android, to make sure important tasks never go unchecked.
By the end of the course, you will be able to implement Firebase and its different tools and services in any app. You will be trained to think from the perspective of your users, build the right backends to support their needs, and run effective tests to make sure the features you build are successful.
About the Author
Eric Decanini is a Firebase developer who immerses himself in too much coffee for his own good and implements backend solutions using Firebase in Android and in AngularJS with the goal of sparking User Engagement through the cloud. He works as a freelancer implementing Firebase backends and services in Android applications and manages a Firebase blog.
At the tender age of 16, he took the role of lead developer to create a School Planner app: Classify. Now he works towards his goal of meeting new people and transforming dull, boring work into a balance of enjoyment that feels like the good days of college… but with more coffee of course.
- This course is for Android developers or freelancers who want to take advantage of the power of a backend connected to the cloud and make their app experience efficient.
- If you are looking for a way to get your app online and utilize powerful tools and services to provide a great user experience with Firebase, this course is for you!