GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — quickstart-android/firestore at master · sajid95/quickstart-android

Expand file tree

/

firestore

/
Copy path

Directory actions

More options

More options

Directory actions

More options

More options

Latest commit

 

History

History
History
 
 
/

firestore

/
Copy path

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
app
app
 
 
docs
docs
 
 
gradle/wrapper
gradle/wrapper
 
 
.gitignore
.gitignore
 
 
CONTRIBUTING.md
CONTRIBUTING.md
 
 
LICENSE
LICENSE
 
 
README.md
README.md
 
 
build.gradle
build.gradle
 
 
gradle.properties
gradle.properties
 
 
gradlew
gradlew
 
 
gradlew.bat
gradlew.bat
 
 
indexes.json
indexes.json
 
 
settings.gradle
settings.gradle
 
 

README.md

Outline

Cloud Firestore Quickstart

Introduction

Fire Eats is a restaurant recommendation app built on Cloud Firestore. For more information about Firestore visit the docs.

Getting Started

  • Set up your Android app for Cloud Firestore
    • Use the package name com.google.firebase.example.fireeats
  • In the Authentication tab of the Firebase console go to the Sign-in Method page and enable 'Email/Password'.
    • This app uses FirebaseUI for authentication.
  • Run the app on an Android device or emulator.

Security Rules

Add the following security rules to your project in the: rules tab:

service cloud.firestore {  
  match /databases/{database}/documents {
    // Anyone can read a restaurant, only authorized
    // users can create, update, or delete them.
  	 match /restaurants/{restaurantId} {
    	 allow read: if true;
    	 allow create, update, delete: if request.auth.uid != null;
    }
    
    // Anyone can read a rating. Only the user who made the rating
    // can delete it. Ratings can never be updated.
    match /restaurants/{restaurantId}/ratings/{ratingId} {
    	 allow read: if true;
      allow create: if request.auth.uid != null;
    	 allow delete: if request.resource.data.userId == request.auth.uid;
    	 allow update: if false;
    }
  }
}

Run the App

  • When you open the app you will be prompted to sign in, choose any email and password.
  • When you first open the app it will be empty, choose Add Random Items from the overflow menu to add some new entries.

Result

Indexes

As you use the app's filter functionality you may see warnings in logcat that look like this:

com.google.firebase.example.fireeats W/Firestore Adapter: onEvent:error
com.google.firebase.firestore.FirebaseFirestoreException: FAILED_PRECONDITION: The query requires an index. You can create it here: https://console.firebase.google.com/project/...

This is because indexes are required for most compound queries in Cloud Firestore. Clicking on the link from the error message will automatically open the index creation UI in the Firebase console with the correct paramters filled in:

This app also provides an index specification file in indexes.json which specifies all indexes required to run the application. You can add all of these indexes programatically using the Firebase CLI.

You are visitor 01402792 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.