firebase-realtime-database

Accessing Firebase Database Objects Below Child

 ̄綄美尐妖づ 提交于 2021-01-29 05:44:06
问题 I have a data structure as such: I am calling .addListenerForSingleValueEvent() on my Polls reference, and I have a Pojo class mapped to the poll. However, since I do not know the value of the key, I cannot access my poll items. Is there a way to access, let's say, display_name, or would I need to know the value of the key? 回答1: If you don't know anything about the poll to show, the best you can do is show all polls. This can be done by attaching a listener to /Polls : DatabaseReference ref =

Google Firebase and http Post to Lists

余生颓废 提交于 2021-01-29 05:42:51
问题 I have a JSON database setup on Google Firebase and I have an Angular 6 App that is looking to post an object to that database. Everything works fine except there is an alphanumeric name appended to my list item and I can't get it off. The database looks like this: { "thursdayPanels": { "panel": [ { "tagline": "tagline 1", "content": "some content 1", "id": 1 }, { "tagline": "tagline 2", "content": "some content 2", "id": 2 }, { "tagline": "tagline 3", "content": "some content 3" "id": 3 } ]

How to access child node using parent key ?? in firebase android

时光怂恿深爱的人放手 提交于 2021-01-29 05:39:20
问题 i have 2 database node one is friends and other User. In User node all the user which are using my app are registered but in friend node those keys are available which are friends. In friends node One key (parent key ) can have multiple child key (also present in User node). Now I want to access data of User node Using Friend child child (2times) key. 来源: https://stackoverflow.com/questions/47616054/how-to-access-child-node-using-parent-key-in-firebase-android

I can't load images retrieved from Firebase into a viewpager

扶醉桌前 提交于 2021-01-29 05:34:27
问题 I have uploaded some images using an android application into Firebase storage, now I want to be able to display those images inside a ViewPager in that same application. I have followed a tutorial where they did the same thing but in a RecycleView, and tried to apply the same thing in my code. Now there seems to be no error when I run my code, but I can't view the images inside the imageView. I need help with my ViewPagerAdapter code please, something is missing on the instantiate method and

FIREBASE FATAL ERROR: Database initialized multiple times

被刻印的时光 ゝ 提交于 2021-01-29 05:13:58
问题 I have multiple database instances in my firebase app. I am trying to write into three database instances in firebase cloud functions. My understanding by following this document is no need to initialize multiple apps for each database instance. We can initialize one and pass in the database url. As a side note, I have another function with similar kind of functionality where I have trigger event in one database and write data to other database instance and it works fine. import * as

Select object with string contains some substrings from Firebase DB

给你一囗甜甜゛ 提交于 2021-01-29 05:04:52
问题 I have firebase database with structure Now I want to select only names with given gender and qualities. I wrote code like this private NameImpl.Gender mGender; private String[] mQualities; ... public void GetNames() { mRef.orderByChild("Gender").equalTo(mGender.name()).addValueEventListener(new ValueEventListener() { @Override public void onDataChange(DataSnapshot dataSnapshot) { getData(dataSnapshot); } @Override public void onCancelled(DatabaseError databaseError) { } }); } But I can't

After 7th child Realtime database “convert” to json array

自闭症网瘾萝莉.ら 提交于 2021-01-29 04:30:45
问题 I'm trying to create a job to execute each day, this procedure will create a child DAY and add many children HOUR inside DAY, the problem is when I try to add more than 7 child, Realtime Database converts my JSON tree in an array. I want this JSON result: { "CALENDAR" : { "8" : { "AVAILABLE" : true, "PURCHASEKEY" : "NA", "TIME" : "8:00", "TITLE" : "NA", "USERID" : "NA", "USERNAME" : "NA" }, "9" : { "AVAILABLE" : true, "PURCHASEKEY" : "NA", "TIME" : "9:00", "TITLE" : "NA", "USERID" : "NA",

Dispatch group crashing because asynchronous function executes multiple time

流过昼夜 提交于 2021-01-29 04:30:43
问题 I am trying to use dispatch groups to wait for two asynchronous processes to finish. However the second asynchronous function loops to the amount of messages I have in my database. The code below crashes because the number of dispatch is not balanced since dispatch leave is higher than the number of dispatch enters due to the multiple executions of the second asynchronous function. Is there a different way to implement dispatch groups in this case. dispatch_group_enter(dispatch_group) ref

Retrieve complex nested data from firebase

让人想犯罪 __ 提交于 2021-01-29 02:56:26
问题 I have the data in firebase as given below: I want to get the Customer and Device details for each of the Form ID. The Form IDs are generated uniquely by firebase. I just somehow need to get access to these Form IDs. I have set the databaseReference as follows: databaseReference = FirebaseDatabase.getInstance().getReference("users").child(userID).child("forms"); Then I have tried the following code to retrieve the required data: databaseReference.addValueEventListener(new ValueEventListener()

How to set variables from a Firebase snapshot (swift)

给你一囗甜甜゛ 提交于 2021-01-29 02:52:08
问题 I would like to grab the data from my Firebase snapshot and set it to variables in my Project. I get the data, but I don't know how to parse it so I can set them. I'm trying to do something like what SwiftyJSON does with API calls. Here is my data structure in firebase: Here is my function: Here is the output in the console: Is there any way to parse and set values from the (ls) array and set the "fromId", "text", "toId" to different variables for each node? 回答1: Try using:- FIRDatabase