I was trying to get some data from my Firebase realtime-database as followed generally, but I couldn’t figure out where in the code the problem was. The code is attached: I also use getter: database image here xml all allmedicine find_medicine xml Answer Change your query to – And according to firebase doc – The class has an empty constructor,
Tag: firebase
How to retrieve data from Firebase database and show the values in Google map?
In my database, I have values about location for each persons like that database structure and I want to retrieve data and show in the map. How get get and show? I created an ArrayList and details class constuctor for get a values. Answer To solve this, please use the following code: But I strongly recommend you, to store the
getting firebase ServerValue.TimeSTAMP in wrong format, how to convert to Date?
I want to get Firebase Server current time, i searched stackoverflow, i found method ServerValue.TIMESTAMP and it’s returning value when i debugged .sv=timestamp i am getting above String, but can’t figure out how to convert it to date. I also tried getting it in hashmap, can somebody please help on this. Note: i haven’t stored date in firebase. Answer this
How to get children keys from Firebase without downloading their children?
I have a Firebase database with a node “items” that has many children and I would like to import a list of the children keys. Since each child contains quite some data that I am not interested in for this purpose, I would like to download only the children keys (to minimize the amount of data transferred). For illustration, suppose
Firestore – Why check if DocumentSnapshot is not null AND call exists?
Take a look at this code example from the Firestore documentation: https://firebase.google.com/docs/firestore/query-data/get-data Why check if document != null? If I read the source code correctly (beginner), the exists method checks for nullity internally. Answer A successfully completed task will never pass null for the DocumentSnapshot. If the requested document does not exist, you’ll get an empty snapshot. This means that:
How to count the number of documents under a collection in Firestore?
I am trying to get CollectionReference count that exists on the Cloud Firestore, I have tried to get it with: But unfortunately, I’m getting: Is there is another way to get the count of another way to fix the IllegalStateException? Answer Edit: October 20th, 2022 Starting from now, counting the documents in a collection or the documents that are returned
How to move from deprecated Task to ApiFuture for firebase admin SDK 5.4 and above
I’m just trying to solve the deprecation notes from my Java code of new firebase-admin SDK, the code is written in version 5.3.1 but after upgrading the version into 5.5.0 the deprecation notes appeared, here is a sample of my code: Using FirebaseAuth (deprecatation on: Task, addOnSuccessListener and addOnFailureListener) : And for FirebaseDatabase (deprecatation on: Task, addOnSuccessListener, addOnFailureListener, updateChildren and
Handling positions in FirebaseRecyclerAdapter
I have fiddled with the FirebaseRecyclerAdapter for quite some time now. It’s really a great tool to populate a custom list/recycler view very fast with all of its features. However, one thing that I would like to ask is how to handle positions of items inside the adapter itself. So for example, I want to mimic this small feature that
Java Get Value from Object by Key Name
I have retrieved an object from Firebase and would like to access the values of it using the name of each field I would like the value for. In javascript, this would be something as simple as myObject.name to retrieve the name in the object. How can I do the equivalent in Java? Answer Try this: If you have a
Where can I get “serviceAccountCredentials.json” for Firebase Admin?
Here is said what I need to set up Firebase on java: But where can I get serviceAccountCredentials.json ? UPDATED: I found that this file seems should have this fields, but where get this values? Answer Found details about this in this link [UPDATED 30.11.2021] To generate a private key file for your service account: In the Firebase console, open