firebase-realtime-database

set value of user rating to Firebase Database

徘徊边缘 提交于 2019-12-25 01:14:46
问题 I try to send the voting from users to firebase and save them under the specific user. class User: NSObject { var id: String? init(dictionary: [String: AnyObject]) { self.id = dictionary["id"] as? String } var ref: DatabaseReference! var numberOfGood = 0 init(id: String? = nil) { self.id = id ref = Database.database().reference().child("users").childByAutoId() } init(snapshot: DataSnapshot){ ref = snapshot.ref if let value = snapshot.value as? [String : Any] { numberOfGood = value[

How to listen to multiple databases in google cloud functions

我是研究僧i 提交于 2019-12-25 01:12:34
问题 I want to listen to two databases in my google cloud functions so I tried this const app1 = admin.initializeApp({ credential: admin.credential.cert(serviceAccount), databaseURL: "https://honey.firebaseio.com" }); const app2 = admin.initializeApp({ credential: admin.credential.cert(serviceAccount), databaseURL: "https://honey-d8.firebaseio.com/" }, 'app2'); // Get the default database instance for an app1 var OperationDB = admin.database().ref(); // Get a database instance for app2 var userDB

How do I increment a value for an existing object in Firebase?

核能气质少年 提交于 2019-12-25 00:57:18
问题 I'm building a step counter app. I got an iOS app that pushes the sum of each day to /users/{mobile}/steps/{date}/ When a new steps child is updated or added, I want to sum the value of all the steps for that particular user and update his stepsTotal . To achieve that I need to Find the original user and sum all the steps. Save the new value to stepsTotal. I would be most grateful if someone could give some help here. :-) database { "users": { "92291000": { "firstName": "Tore", "stepsTotal":

Is it possible to bring the “user” object to the “top level” and access it from outside the “on.AuthSateChanged(user => … }”? [duplicate]

房东的猫 提交于 2019-12-25 00:44:33
问题 This question already has answers here : Retrieve String out of addValueEventListener Firebase (3 answers) Closed last year . I am trying to define a ref in vuefire to firebase path that depends on the current User. Is it possible to bring the "user" object to the "top level" and access it from outside the "on.AuthSateChanged(user => .... }" ? firebase-config.js import * as firebase from "firebase"; var config = { apiKey: "XXXXXX", authDomain: "XXXXXX.firebaseapp.com", databaseURL: "https:/

How to properly implement Logout with firebase on flutter

这一生的挚爱 提交于 2019-12-25 00:39:22
问题 It sounds stupid but I cant really properly logout of my app and that is because I use multiple FirebaseAnimatedList and route on my MaterialApp routes: <String,WidgetBuilder>{ '/StartAppPage':(BuildContext context)=>new StartAppPage(), '/LoginPage':(BuildContext context)=> new LoginPage(), '/HomePage':(BuildContext context)=> new HomePage) }, So the app checks for use and routes to HomePage or Login based on is there is a user or not. My Home page has a FirebaseAnimatedList and on my Home

Trying to use data outside the onDataChange() in Firebase

我的梦境 提交于 2019-12-25 00:37:14
问题 I am new in this ! Please can someone help me. I know that here I am dealing with asynchronous programming, I am trying to return the String but it still returning null. Can someone tell me where I am wrong. public interface OnGetDataListener { public void onStart(); public void onSuccess(DataSnapshot data); public void onFailed(DatabaseError databaseError); } public void mReadDataOnce(String email ,String child, final OnGetDataListener listener) { listener.onStart(); myRef.child(email).child

How to get all child data from firebase without knowing the path

谁说我不能喝 提交于 2019-12-25 00:27:10
问题 My data structure looks like this: I want to be able to access every users listings to make an array of all listings however I do not know every users ID or Listing ID so i can not do: Database.database().reference.child("users").child(uid)...... because it is not for just one UID. if there a way to 'skip' over the .child(uid) and .child(listingID) when pulling from firebase? 回答1: If you want to retrieve all data for all users, you can attach your observer to the entire /users node. That will

Tring to populate a list view using a Firebase Query to create a leaderboard

可紊 提交于 2019-12-25 00:13:54
问题 I can't seem to populate a list view when I use a Query. I can populate it fine by just passing in all Users, although i am trying to create a leaderboard so I need to order these users. when I use the following code the list view populates fine but of course not ordered: database = FirebaseDatabase.getInstance().getReference().child("Users"); listview = (ListView) findViewById(R.id.Leaderboard); adapter = new ArrayAdapter<>(this, android.R.layout.simple_list_item_1,leaderboardlist); listview

Why does update() completely overwrites my data in Firebase? set() vs. update()

◇◆丶佛笑我妖孽 提交于 2019-12-25 00:12:32
问题 I have went through Firebase doc, plus I have found a few topics on stackoverflow about set() vs. update() in Firebase: e.g.here It is very clear what is the difference between the two of them. In the following code, why does update() overwrites my existing data? function saveChanges(event) { event.preventDefault(); let modifiedTitle = document.getElementById('blog-title').value; let modifiedContent = document.getElementById('blog-content').value; let modifiedId = document.getElementById(

How to skip the signUp activity and proceed to the homescreen in android [closed]

a 夏天 提交于 2019-12-25 00:06:57
问题 Closed . This question needs to be more focused. It is not currently accepting answers. Want to improve this question? Update the question so it focuses on one problem only by editing this post. Closed last year . I have Profile class where the user enters his name and email. but whenever I open the app it asks the user to enter name. how do I skip this and make it show it to the user only once. I can use the if username != null method but every time user opens app it fetches data from