Save Data in Firestore | Android App Development | Lecture#54 | Hive Learners
𝓖𝓻𝓮𝓮𝓽𝓲𝓷𝓰𝓼
Dear Hive Learners in Lecture 53 we learn how to configure Firebase Firestore to our project. We also learn what the advantages of Firestore.Today we will practically store data in the Firestore and fix some bugs in the current code. Let's get started.
GitHub Link
Use this GitHub project to clone into your directory. The following lecture will update it so you will never miss the latest code. Happy Coding!
What Should I Learn
- How to store data to Firestore
Assignment
- Store data in Firestore
Procedure
First of all, we need to add the data in a hashMap that we need to store. Declare and initialize Firestore that we have already done in lecture 53.
We will use the name sendings as the parent path. In Firestore it is called the collection, and the child of a collection is called the document. We will use doc_id to set the document ID and also store this PushKey.
Copy the task complete listener code that is in the sendings_ref. We are going to remove this code but the onCompleteListener can be reusable. Also, move the progress dialog code on top of this Firestore listener.
Run the loginand ogin to the app. Today I run the App on my real Mobile Device and I get an Error. I look into the code and finally found that there were two theme files one for the daily theme and one for the night. We change the parent theme In the theme.xml but do not change it in the theme.xml night file. On my mobile device dark mode is on and the app is crashing so we need to set the parent theme to MaterialDesign in the night theme also.
Copy the theme.xml code and paste it into the night theme.
We also need to set the Database in the Firebase Console. Open the Firestore window.
Click on create a database and wait until it is complete.
Run the app and store the data. Data is saved successfully in the Firestore database. In the next lecture, we retrieve this data in our app.
Thank You
Leave Save Data in Firestore | Android App Development | Lecture#54 | Hive Learners to:
Read more #hive-153850 posts
Best Posts From Muhammad Faisal Amin
We have not curated any of faisalamin's posts yet. But you can encourage our curation team to review posts by visiting them regularly and by referring other readers. Because we give priority to frequently read content.
More Posts From Muhammad Faisal Amin
- Best Family Relationships Practices
- Grocery for creamy fruitĀ chat
- Shopping in Rainy Day
- Delicious Chinese food withĀ family
- Protest in my City
- Attended PTM of my cusion
- Delicious job treat from belovedĀ friend
- Visited nearby school for invigilation of scienceĀ projects
- Water quality monitoring at my universityĀ lab
- First ride in my Friends's newĀ car