firebase-realtime-database

How to store user data using Firebase in Android?

蹲街弑〆低调 提交于 2020-06-25 06:48:23
问题 I need to create and use a database entry with all details (uid, name etc) for each user that logs in to the application I am having trouble storing user data in order to use and retrieve user profile info using Firebase in Android. I found this documentation on the old version of Firebase but this does not seem to work any longer. Does anyone know how to reproduce the above code so it works with the new version of Firebase? Many thanks in advance. Edit - code below: final Firebase ref = new

Store Firebase data into array in JavaScript

那年仲夏 提交于 2020-06-24 16:42:50
问题 I tried to get the data from Firebase and store it into an array. However, when I try to get the data from the array, it became undefined. Can anyone tell me why would it happened? var events = []; var databaseRef = database.ref("events").orderByChild("date"); databaseRef.on('child_added', function(snapshot) { var event = snapshot.val(); events.push({ title: event.title, content: event.content }); }); console.log(events); console.log(events[0]); console.log(events.pop()); In #1, all the data

How to get the last added data on first in the listview from firebase realtime database in android studio

房东的猫 提交于 2020-06-23 18:56:29
问题 I have a list view to retrieve the data from firebase realtime database. But the problem is I want to show the last added data on the top of the listview...Its a notice board type project so, I want to show the latest notice on the to of the listview...could't find some good solutions on the web.... here are the codes of "mainactivity.java".... package com.example.wrappo; import androidx.annotation.NonNull; import androidx.annotation.Nullable; import androidx.appcompat.app.AppCompatActivity;

Duplicate Data from Firebase when I use .value

[亡魂溺海] 提交于 2020-06-23 14:08:37
问题 I get duplicate data (old and updated data) in my UITableView whenever I update my data from firebase. I am actually trying to create a realtime database for my UITableView . var foodlist = [FoodModel]() @objc func load_data() { Database.database().reference().child("Food").observe(.value) { (snapshot: DataSnapshot) in if let dict = snapshot.value as ? [String: AnyObject] { for child in dict.values { if let FoodimageText = child["image"] as ? String, let FoodnameText = child["name"] as ?

Duplicate Data from Firebase when I use .value

99封情书 提交于 2020-06-23 14:07:37
问题 I get duplicate data (old and updated data) in my UITableView whenever I update my data from firebase. I am actually trying to create a realtime database for my UITableView . var foodlist = [FoodModel]() @objc func load_data() { Database.database().reference().child("Food").observe(.value) { (snapshot: DataSnapshot) in if let dict = snapshot.value as ? [String: AnyObject] { for child in dict.values { if let FoodimageText = child["image"] as ? String, let FoodnameText = child["name"] as ?

Listen to firebase database changes when app is closed

这一生的挚爱 提交于 2020-06-23 11:14:52
问题 I am creating an Ionic 2 app with firebase and I need a way to listen to database changes (specifically on child_added) when the app is closed (I.e. in foreground,background and killed) Basically, I want to use WebRTC to make calls within the app like whatsapp and I am following this post - https://websitebeaver.com/insanely-simple-webrtc-video-chat-using-firebase-with-codepen-demo However, the only thing that puzzles me is how it will work when the app is closed. Can anyone please help me

Listen to firebase database changes when app is closed

我的梦境 提交于 2020-06-23 11:14:21
问题 I am creating an Ionic 2 app with firebase and I need a way to listen to database changes (specifically on child_added) when the app is closed (I.e. in foreground,background and killed) Basically, I want to use WebRTC to make calls within the app like whatsapp and I am following this post - https://websitebeaver.com/insanely-simple-webrtc-video-chat-using-firebase-with-codepen-demo However, the only thing that puzzles me is how it will work when the app is closed. Can anyone please help me

how to join two tables and get all data base on child in firebase

Deadly 提交于 2020-06-23 05:15:31
问题 i wanted to get the data from two tables in firebase db the 1st table was from here i want to get the next data from table based on the hospital_fk this is the result it got on my json and here is my script for getting the data.. router.get('', function(req, res){ var booths = database.ref('booths'); var hospital = database.ref('hospitals'); booths.once('value', function (snapshot) { var dataSet = []; snapshot.forEach(function (childSnapshot) { var childKey = childSnapshot.key; var fk =

How quickly can you atomically increment a value on the Firebase Realtime Database?

感情迁移 提交于 2020-06-21 18:22:24
问题 firebaser here When I recently tweeted about the new increment() operator in the Firebase Realtime Database, a team mate asked how fast increment() is. I've been wondering the same: how fast can you increment a value with increment(1) ? And how does that compare to using a transaction to increment a value? 回答1: TL;DR I tested these cases: Increment a value with a transaction call: ref.transaction(function(value) { return (value || 0) + 1; }); Increment a value with the new increment operator:

Sort array result with date key in firebase database

[亡魂溺海] 提交于 2020-06-18 17:27:31
问题 I am fetching some records from firebase database in a RecyclerView. I am already fetching the data on the basis of a specific key-value. Now I want the data to be sorted for a date key whose format is MM-dd-yyyy. How can I sort it? My code to fetch it: FirebaseRecyclerAdapter<Eventsdata,Eventshistory.Game> adapter=new FirebaseRecyclerAdapter<Eventsdata,Eventshistory.Game>(Eventsdata.class ,R.layout.eventshistoryrow ,Eventshistory.Game.class ,reference.child("Events").orderByChild("uid")