firebase-realtime-database

Get parent key value on click of child in recyclerview from firebase database

老子叫甜甜 提交于 2021-01-29 12:08:47
问题 I am creating a recycler view in which, I am getting Survey Name which is child of survey reference number in firebase database. What I want is when user click on survey name in recyclerview list it gets the parent KeyValue (which is survey reference number). I have attached the image of the database. On click survey name encircled which blue line, I want the parent key shaded with yellow line I have used an Interface in adapter class where I am getting position and modelResponse public

Value of firebase functions onwrite sometimes is null

情到浓时终转凉″ 提交于 2021-01-29 12:03:44
问题 I'm trying to implement an Android ordering system and I'm using Realtime Database. To send notifications I'm using Firebase Functions in JavaScript. Each user is stored in the database along with their id, token to send the notification, among other data. What I'm trying to do is detect when a user receives an order and send them a notification . The problem appears here. In some cases the notification is sent and in others it is not . Viewing the logs of my "sendNotif" function I see that

Firebase query orderByChild

我是研究僧i 提交于 2021-01-29 11:19:31
问题 I want to perform a query to a firebase database. My database is as follows: I want to query "paymentStatus" by orderByChild value "paid". How will my query code look? The below code not reading. Query query = FirebaseDatabase.getInstance().getReference().child("Visits") .orderByChild("paymentStatus").equalTo("Paid"); Thank you in advance. 回答1: Firebase database queries function on a list of child nodes, not on a tree. The database takes each direct child node under the location you query and

How to change firebase databse by connectivity status from background?

倾然丶 夕夏残阳落幕 提交于 2021-01-29 11:11:43
问题 I tried to change database onDisconnect method. I want to change the database when connectivity available from background. For example, Suppose currently i am in MainActivity and status is Online and in onPause and onDestroy it becomes offline. For my side it is not enough to set online/offline status. For this i want if i have connectivity (background and foreground) my status is online if i lost connectivity in the BACKGROUND, my status is offline. And whenever connectivity is available and

Continue insert new data in existing array in Firebase Database from Android

故事扮演 提交于 2021-01-29 11:08:47
问题 I'm just starting to learn android studio and I'm working on a location-based project to insert location information into Firebase. I followed tutorial from youtube [https://www.youtube.com/watch?v=CwxdfamaCrk], however in the video only shows insert data from the code which is like this; infectedArea = new ArrayList<>(); infectedArea.add(new LatLng(2.2258162, 102.4497224)); infectedArea.add(new LatLng(2.2252313, 102.4563797)); infectedArea.add(new LatLng(2.2261818, 102.4551067));

Appending data from Firebase to array [duplicate]

怎甘沉沦 提交于 2021-01-29 11:05:51
问题 This question already has answers here : Completion handler Firebase observer in Swift (4 answers) Closed 2 years ago . I have these arrays that I want to display in a tableView: private var firOrder = [String]() private var firDate = [Int]() I try to get and append the data like this: override func viewDidLoad() { ref = Database.database().reference() ref?.child("users").child(user).child("Orders").observe(.value, with: { (snapshot) in let values = snapshot.value as? [String: AnyObject] let

Firebase returning null references when GET after DELETE

旧街凉风 提交于 2021-01-29 10:52:15
问题 Im running a react app with Firebase in the back. I have an endpoint "/items". When I invoke a DELETE request through Axios, the database reflects the correct data. However, after the DELETE request when I invoke a GET request to retrieve updated "items" I get a null reference where the deleted item was, leading to a null reference error. EXAMPLE -Original [item1, item2, item3] *Delete item2 -Get - [item1, null, item3] However on Firebase it is reflected correctly.. class VendingMachine

Firebase string match at end of field [duplicate]

和自甴很熟 提交于 2021-01-29 10:35:42
问题 This question already has answers here : How to perform sql “LIKE” operation on firebase? (5 answers) Closed 2 years ago . Imagin the following data: { "name": "Abcdef", "age": 21 }, { "name": "Rodrigo", "age": 24 }, { "name": "Matt", "age": 30 }, { "name": "Def", "age": 21 } How do I make the equivlant to this search: SELECT * FROM table WHERE name = "%def" so that I get this result: { "name": "Abcdef", "age": 21 }, { "name": "Def", "age": 21 }, (or at least the first result because its %def

Reading Firebase data and populating recyclerview

社会主义新天地 提交于 2021-01-29 10:32:11
问题 I'm trying to read the data from Firebase and display it in a recyclerview with a card layout. I have a seperate activity for writing to Firebase and a fragment that actually displays the data in the app. The app builds fine and runs, but crashes when I try to look at the fragment containing the recyclerView. 1) Fragment displays RecyclerView package com.nikelspot.alpha; import android.support.annotation.NonNull; import android.support.v4.app.Fragment; import android.os.Bundle; import android

Firebase returns false value when there is a value present in the collection using node.js

左心房为你撑大大i 提交于 2021-01-29 10:30:39
问题 I'm trying to verify a record in Firebase before registering the user with post request using node.js ***** Node.js Code **** function checkUserExist(email) { var userExist = false; userRef.orderByChild('email').equalTo(email).once('value').then(function (snapshot) { if (snapshot.exists()) { userExist = true; console.log(userExist); // Here the value is returned true } }); return userExist; } app.post('/register', urlencodedParser, function (req, res) { var testUser = checkUserExist(req.body