Cloud Firestore Android example – CRUD Operations with RecyclerView
Tags: firestore, crud, recyclerview, cloud
Published: 2021-04-20 17:26:04

https://grokonez.com/android/cloud-firestore-android-example-crud-operations-with-recyclerview

Cloud Firestore Android example – CRUD Operations with RecyclerView

Cloud Firestore helps us store data in the cloud. It supports offline mode so our app will work fine (write, read, listen to, and query data) whether device has internet connection or not, it automatically fetches changes from our database to Firebase Server. We can structure data in our ways to improve querying and fetching capabilities. This tutorial shows you an Android app that can do Firestore CRUD Operations with <code>RecyclerView</code>.

Related Post: <a href="https://grokonez.com/android/cloud-firestore-android-example-crud-operations-firestorerecycleradapter-firebase-ui">Cloud Firestore Android example – CRUD Operations with FirebaseUI FirestoreRecyclerAdapter</a>

<!--more-->
<h2>I. Technologies</h2>
- Android Studio 3
- Firebase Firestore 11.8.0
<h2>II. Overview</h2>
<h3>1. Goal</h3>
We will build an Android App that supports showing, inserting, editing, deleting Notes from/to Cloud Firestore Database with <code>RecyclerView</code>:

<img src="https://grokonez.com/wp-content/uploads/2018/01/cloud-firestore-crud-demo-show-notes.png" alt="cloud-firestore-crud-demo-show-notes" width="657" height="514" class="alignnone size-full wp-image-10246" />

Firebase Console for Firestore will be like:

<img src="https://grokonez.com/wp-content/uploads/2018/01/cloud-firestore-crud-demo-console-show-notes.png" alt="cloud-firestore-crud-demo-console-show-notes" width="700" height="230" class="alignnone size-full wp-image-10250" />
<h3>2. Cloud Firestore</h3>
<h4>2.1 Add Firestore to Android App</h4>
- Create Android Project, then go to <a href="https://console.firebase.google.com" rel="nofollow" target="_blank">Firebase Console</a>, create Firebase Project:

<img src="https://grokonez.com/wp-content/uploads/2018/01/cloud-firestore-console-add-project.png" alt="cloud-firestore-console-add-project" width="510" height="483" class="alignnone size-full wp-image-10247" />

- When your app is created on Firebase Console, you will need to register Android Project. Now fill project package name to register your app:

<img src="https://grokonez.com/wp-content/uploads/2018/01/cloud-firestore-console-add-firebase-android.png" alt="cloud-firestore-console-add-firebase-android" width="677" height="575" class="alignnone size-full wp-image-10249" />

- Download <strong>google-service.json</strong> config file and follow instructions:

<img src="https://grokonez.com/wp-content/uploads/2018/01/cloud-firestore-console-add-firebase-android-json.png" alt="cloud-firestore-console-add-firebase-android-json" width="669" height="615" class="alignnone size-full wp-image-10251" />

- Add Service plugin for Gradle:

<img src="https://grokonez.com/wp-content/uploads/2018/01/cloud-firestore-console-add-firebase-gradle.png" alt="cloud-firestore-console-add-firebase-gradle" width="529" height="526" class="alignnone size-full wp-image-10252" />

https://grokonez.com/android/cloud-firestore-android-example-crud-operations-with-recyclerview

Cloud Firestore Android example – CRUD Operations with RecyclerView