{"id":16082140,"url":"https://github.com/varunon9/firestore-database-utility","last_synced_at":"2026-05-01T16:36:26.148Z","repository":{"id":93827113,"uuid":"155319186","full_name":"varunon9/firestore-database-utility","owner":"varunon9","description":"An utility class to access firestore database for Android (getOne, create, update, getMany).","archived":false,"fork":false,"pushed_at":"2018-10-30T04:19:52.000Z","size":7,"stargazers_count":3,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-04-05T11:44:48.740Z","etag":null,"topics":["android","firebase","firestore","firestore-database","firestore-database-query"],"latest_commit_sha":null,"homepage":null,"language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/varunon9.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2018-10-30T03:30:27.000Z","updated_at":"2020-07-07T15:42:52.000Z","dependencies_parsed_at":"2023-06-15T06:30:36.533Z","dependency_job_id":null,"html_url":"https://github.com/varunon9/firestore-database-utility","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/varunon9/firestore-database-utility","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/varunon9%2Ffirestore-database-utility","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/varunon9%2Ffirestore-database-utility/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/varunon9%2Ffirestore-database-utility/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/varunon9%2Ffirestore-database-utility/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/varunon9","download_url":"https://codeload.github.com/varunon9/firestore-database-utility/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/varunon9%2Ffirestore-database-utility/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32505110,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-30T13:12:12.517Z","status":"online","status_checked_at":"2026-05-01T02:00:05.856Z","response_time":64,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["android","firebase","firestore","firestore-database","firestore-database-query"],"created_at":"2024-10-09T11:25:53.171Z","updated_at":"2026-05-01T16:36:26.122Z","avatar_url":"https://github.com/varunon9.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":"# firestore-database-utility\nAn utility class to access firestore database for Android (getOne, create, update, getMany).\n\n[FirestoreDbUtility.java](https://github.com/varunon9/firestore-database-utility/blob/master/FirestoreDbUtility.java) is wrapper class to interact with firestore database in Android. Copy and paste this class along with all other helper classes and interface- [FirestoreQueryConditionCode.java](https://github.com/varunon9/firestore-database-utility/blob/master/FirestoreQueryConditionCode.java), [FirestoreQuery.java](https://github.com/varunon9/firestore-database-utility/blob/master/FirestoreQuery.java), [FirestoreDbOperationCallback.java](https://github.com/varunon9/firestore-database-utility/blob/master/FirestoreDbOperationCallback.java) in your android project.\n\n## Sample Usage-\n\nFirst of all create an instance of `FirestoreDbUtility` in your `ExampleActivity` something like-\n\n`FirestoreDbUtility firestoreDbUtility = new FirestoreDbUtility();`\n\nDefine collection name-\n\n`String collectionName = \"users\"; // collection (table) name `\n\n\n### GET unique document from firestore collection\n\n    ```\n    String documentName = \"4PkPVt4jGnO5neiKTKbe9I8B9yz2\"; // may be uid of FirebaseUser i.e. firebaseUser.getUid()\n    \n    firestoreDbUtility.getOne(collectionName, documentName,\n                new FirestoreDbOperationCallback() {\n            @Override\n            public void onSuccess(Object object) {\n                DocumentSnapshot documentSnapshot = (DocumentSnapshot) object;\n                User user = documentSnapshot.toObject(User.class); // User.java is a model class\n                System.out.println(user.getEmail()); // do anything with your user object\n            }\n\n            @Override\n            public void onFailure(Object object) {\n\n            }\n        });\n    ```\n    \n### CREATE a document in firestore collection or MERGE if document already exists\n\n    ```\n    User user = new User(); // create an instance of User class and set relevant properties\n    user.setEmail('email@example.com');\n    user.setUid('4PkPVt4jGnO5neiKTKbe9I8B9yz2');\n        \n    firestoreDbUtility.createOrMerge(collectionName,\n                  user.getUid(), user, new FirestoreDbOperationCallback() {\n              @Override\n              public void onSuccess(Object object) {\n              }\n\n              @Override\n              public void onFailure(Object object) {\n              }\n          });\n    ```\n    \n### UPDATE a document in firestore collection\n\n    ```\n    // set isOnline true of user\n    Map\u003cString, Object\u003e hashMap = new HashMap\u003c\u003e();\n    hashMap.put(\"online\", true);\n    \n    firestoreDbUtility.update(collectionName,\n                  firebaseUser.getUid(), hashMap, new FirestoreDbOperationCallback() {\n              @Override\n              public void onSuccess(Object object) {\n              }\n\n              @Override\n              public void onFailure(Object object) {\n              }\n          });\n    ```\n    \n### QUERY or getMany documents from firestore collection\n\n    ```\n    GeoPoint lesserGeoPoint = new GeoPoint(12.1, 77.1); // latitude is 12.1 and longitude is 77.1\n    GeoPoint greaterGeoPoint = new GeoPoint(13.0, 78);\n    \n    List\u003cFirestoreQuery\u003e firestoreQueryList = new ArrayList\u003c\u003e();\n    firestoreQueryList.add(new FirestoreQuery(\n            FirestoreQueryConditionCode.WHERE_LESS_THAN,\n            \"location\",\n            greaterGeoPoint\n    ));\n    firestoreQueryList.add(new FirestoreQuery(\n            FirestoreQueryConditionCode.WHERE_GREATER_THAN,\n            \"location\",\n            lesserGeoPoint\n    ));\n    \n    firestoreDbUtility.getMany(collectionName,\n                firestoreQueryList, new FirestoreDbOperationCallback() {\n            @Override\n            public void onSuccess(Object object) {\n                QuerySnapshot querySnapshot = (QuerySnapshot) object;\n                for (DocumentSnapshot documentSnapshot: querySnapshot.getDocuments()) {\n                    User user = documentSnapshot.toObject(User.class); // do something with user object\n                }\n            }\n\n            @Override\n            public void onFailure(Object object) {\n                showMessage(\"Failed to locate nearby travellers.\");\n            }\n        });\n    \n    ```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvarunon9%2Ffirestore-database-utility","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fvarunon9%2Ffirestore-database-utility","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvarunon9%2Ffirestore-database-utility/lists"}