TheDeveloperBlog.com

Home | Contact Us

C-Sharp | Java | Python | Swift | GO | WPF | Ruby | Scala | F# | JavaScript | SQL | PHP | Angular | HTML

Firebase Firestore setup and configuration

Firebase Firestore setup and configuration with What is Firebase, Features, Android Studio, Assistance, Adding Firebase to App, Installation, Data, Firebase Arrays, Event Types, Firebase Queries, Firebase Security etc.

<< Back to FIREBASE

Firestore setup and configuration

In our previous section, we learned about the Cloud Firestore, its key capabilities, features, and how it works. Now, we will discuss how we set up and configure an Android application with Firebase to use Cloud Firestore in our application. Just like Firebase Real-time Database and Firebase Authentication, Firestore's starting steps are the same and will use Kotlin. So, let's start with the starting steps and elaborate each step, which is performed to set up and configure the application to use Firestore in Firebase.

Step 1:

In the first step, we will create a new Android Studio project with an empty activity and Kotlin language and give it name FirestoreExample.

Firebase Firestore setup and configuration

Step 2:

In the next step, we will connect our Android Application with the Firebase either from Firebase Assistant or manually using console. After that, we will add all the required libraries and plugin to our app.gradle file. And we will also add mavenLocal() as our repository and all projects.

Firebase Firestore setup and configuration
Firebase Firestore setup and configuration

Step 3:

Go to the Firebase console and look at the Real-time database. In Developers-> Database, there will be two options, i.e., cloud Firestore and Real-time database.

Firebase Firestore setup and configuration

Step 4:

In the next step, we will create a database by clicking on the Create database. After clicking on Create database, a popup box is open where we create a database with specific rules. We will use it as a test mode, so select to start in test mode. And last click on next.

Firebase Firestore setup and configuration
Firebase Firestore setup and configuration

After clicking on Next, a popup box will open. Here, we can select our Cloud Firestore location depending on where we want to locate. At last, click on Done.

Firebase Firestore setup and configuration

Step 5:

After clicking on Done, a Firestore Database will be created, which will look a little bit different from the Real-time Database. Here, we have Data, Rules, Indexes, and, Usage for data storing, security rules, indexes, and usage, respectively.

Firebase Firestore setup and configuration

Step 6:

Now, change our security rules because, by default, anybody can access our database right now. The changes will be done in such a way that only authenticated users can access the database. And after making changes, we will publish them. The security rules are defined as:

rules_version = '2';
service cloud.firestore {
  match /databases/{database}/documents {
    match /{document=**} {
      allow read, write: if request.auth.uid!=null;
    }
  }
}

Firebase Firestore setup and configuration

Setup and configuration are completed here, and now we can implement our code manipulation of data.






Related Links:


Related Links

Adjectives Ado Ai Android Angular Antonyms Apache Articles Asp Autocad Automata Aws Azure Basic Binary Bitcoin Blockchain C Cassandra Change Coa Computer Control Cpp Create Creating C-Sharp Cyber Daa Data Dbms Deletion Devops Difference Discrete Es6 Ethical Examples Features Firebase Flutter Fs Git Go Hbase History Hive Hiveql How Html Idioms Insertion Installing Ios Java Joomla Js Kafka Kali Laravel Logical Machine Matlab Matrix Mongodb Mysql One Opencv Oracle Ordering Os Pandas Php Pig Pl Postgresql Powershell Prepositions Program Python React Ruby Scala Selecting Selenium Sentence Seo Sharepoint Software Spellings Spotting Spring Sql Sqlite Sqoop Svn Swift Synonyms Talend Testng Types Uml Unity Vbnet Verbal Webdriver What Wpf