firebase-realtime-database

Removing ChildEventListener

元气小坏坏 提交于 2019-12-24 11:29:25
问题 I'm using Firebase childEventListener which is added N-number of times to a Node to get data from the DB. Now I'm trying to remove the childEventListener and it does not seem to work and I get duplicate data. query = FirebaseDatabase.getInstance().getReference() .child("chat") .child("room-messages") .child(roomID) .orderByChild("timestamp") .limitToLast(index); paginationListener = query.addChildEventListener(new ChildEventListener() { @Override public void onChildAdded(DataSnapshot

How getChildrenCount() works in the background?

你离开我真会死。 提交于 2019-12-24 11:12:55
问题 In my database I have lets say more than 5000 users, now if I use getChildrenCount() in the main parent node to get how many people do I have I know that getChildrenCount returns a long with the quantity of children inside a parent but, how this affects performance ? Months ago I made an app to manage users more efficient than doing it from the web console, since the page became static and the users growth. Now, I want to know if every time I request the quantity of users the app is looping

How to open a new activity when an item is clicked in Firebase RecyclerView

岁酱吖の 提交于 2019-12-24 11:02:02
问题 I have used FirebaseRecyclerView from Firebase UI to show a list of data. Now when I click on one of the items, depending on the ID of the item in database, I want to open DetailActivity. How can I get Firebase generated ID(eg: -KRAVjAhr6A_spgJZEET) in populateViewHolder . Query queryRef = mDatabase.child("user-tickets").child(userId); FirebaseRecyclerAdapter<Ticket, TicketViewHolder> adapter = new FirebaseRecyclerAdapter<Ticket, TicketViewHolder>( Ticket.class, R.layout.item_ticket,

Firebase unable to retrieve data using class [duplicate]

旧时模样 提交于 2019-12-24 10:59:48
问题 This question already has an answer here : users does not define no argument constructor [duplicate] (1 answer) Closed last year . I have some fully functional lines of code retrieving each single data, but failed to retrieve them using class. Eg: These lines are working perfectly. double value = (double) ds.child("player1score").getValue(); long value = (long) ds.child("point").getValue(); Yet, when retrieving using class, error occurs. Here are the whole picture of my codes, not sure if it

Change marker position by Realtime lat & lang in Firebase database without added new one marker

霸气de小男生 提交于 2019-12-24 10:56:23
问题 My realtime Firebase database I try to change position for many lat langs at some time like cars in uber, but when I change lat or lang or both this don't change the position of marker but its make anew marker. I want when lat for example is changed in realtime database the markers also changed based on the value of that lat I try make condition `if (marker != null) setPosition else "marker == null"` add new marker but the problem is I have >1 markers so that this solution is display me on

Firebase filter with pagination

天大地大妈咪最大 提交于 2019-12-24 10:39:49
问题 I'm doing an opensource Yelp with Firebase + Angular. My database: { "reviews" : { "-L0f3Bdjk9aVFtVZYteC" : { "comment" : "my comment", "ownerID" : "Kug2pR1z3LMcZbusqfyNPCqlyHI2", "ownerName" : "MyName", "rating" : 2, "storeID" : "-L0e8Ua03XFG9k0zPmz-" }, "-L0f7eUGqenqAPC1liYj" : { "comment" : "me second comment", "ownerID" : "Kug2pR1z3LMcZbusqfyNPCqlyHI2", "ownerName" : "MyName", "rating" : 3, "storeID" : "-L0e8Ua03XFG9k0zPmz-" }, }, "stores" : { "-L0e8Ua03XFG9k0zPmz-" : { "description" :

Typescript : I can't get the data out of Firebase promise

烂漫一生 提交于 2019-12-24 10:38:32
问题 I am trying to pull data (the name of the user) down from firebase. I am able to pull the data down but I am not able to assign the data to anything out of firebase function. How am I supposed to get data out and use it? I want to simply update a label with the data I pull down. getData(){ var userID = this.firAuth.auth.currentUser.uid; var name; console.log("userID: " + userID); this.name = "user"; this.firService.database.ref("/users").once('value').then(function (snapshot){ snapshot

Firebase onCreate trigger: can't get authType other than UNAUTHENTICATED

六月ゝ 毕业季﹏ 提交于 2019-12-24 09:59:12
问题 Using a Firebase Realtime Database with these rules: { "rules": { "messages": { ".read": "auth != null", ".write": "auth != null" } } } And, having this trigger defined as: exports.localOnCreate = functions.database.ref('/messages/{messageId}') .onCreate((snap, context) => { console.log(context); }); When I run this on the test website (authenticated via Google): firebase.database().ref('/messages').push().set({ 'hi': 'from-web' }).then( function(result) { console.log(result); ... }) I see

Timestamp returns an error on BigQuery when sent by Firebase Functions

爱⌒轻易说出口 提交于 2019-12-24 09:57:34
问题 I'm trying to send timestamp field to BigQuery from Firebase Functions. I'm sending admin.firestore.FieldValue.serverTimestamp() and The field on BigQuery is TIMESTAMP type. by i receive an error: table.insert: {"errors":[{"errors":[{"message":"This field is not a record.","reason":"invalid"}]}],"response":{"kind":"bigquery#tableDataInsertAllResponse","insertErrors":[{"index":0,"errors":[{"reason":"invalid","location":"datetime","debugInfo":"","message":"This field is not a record."}]}]},

How to retrieve the data ? Firebase 3.0 database

爷,独闯天下 提交于 2019-12-24 09:39:30
问题 How can i retrieve all the childs from "compresor_1" for example? Firebase database: "CompresoresEstandar" : { "Compresor_1" : { "Marca" : "SANDEN", "Modelo" : "505/5H09", "Canales" : "PV5", "Dimametro-MM" : "120", "Voltios" : "12", "Conexion" : "V-O", }, "Compresor_2" : { "Marca" : "SANDEN", "Modelo" : "505/5H09", "Canales" : "PV5", "Dimametro-MM" : "120", "Voltios" : "12", "Conexion" : "V-O", }, Tried this example from the net but it shows me this error: com.google.firebase.database