firebase-realtime-database

Cloud Functions Firebase v1.0 won't initialize

試著忘記壹切 提交于 2019-12-22 04:47:37
问题 With the latest update of firebase cloud functions, I am getting errors while initializing app, as well as database ref. First Error: Following should work based on Firebase functions v1.0 documentation and samples ( https://github.com/firebase/friendlychat-web/blob/master/cloud-functions/functions/index.js ) const functions = require('firebase-functions'); const admin = require('firebase-admin'); admin.initializeApp(); //this fails I get following error on firebase deploy for above code:

ERROR in AppComponent cannot be used as an entry component

烂漫一生 提交于 2019-12-22 04:37:28
问题 Hey I'm new to using Angular and web development, I've been walking through a few tutorials. When trying to incorporate use of my Firebase Database, upon compilation locally (using ng serve) my application is failing. Returning: "AppComponent cannot be used as an entry component" If you could offer any help that'd be great. Thanks in advance :) //app.component.ts import { Component } from '@angular/core'; import {AuthService} from "./services/auth.service"; import {Router} from "@angular

Modelling a Chat like Application in Firebase

独自空忆成欢 提交于 2019-12-22 04:07:39
问题 I have a Firebase database structuring question. My scenario is close to a chat application. Here are the specifics - users(node storing several users of the app) - id1 name: John - id2 name: Meg - id2 name: Kelly - messages(node storing messages between two users) - message1 from: id1 to: id2 text: '' - message2 from: id3 to: id1 text: '' Now imagine building a conversations view for an individual user. So I want to fetch all messages from that particular user and to that particular user I

Cloud Functions for Firebase: serializing Promises

非 Y 不嫁゛ 提交于 2019-12-22 03:58:53
问题 In an onWrite handler, I'd like to perform multiple reads, manipulate some data, and then store it. I'm fairly new to the Promise concept. Am I safe with the following Promise handling, in regards to Firebase not killing my queries before they're done? exports.test = functions.database.ref('/zzz/{uid}').onWrite(event => { console.log('zzz', event.data.val()); return Promise.all([ admin.database().ref('/zzz/1').once('value'), admin.database().ref('/zzz/2').once('value') ]).then(function(snaps)

nodejs firebase error RangeError: Maximum call stack size exceeded failure

半世苍凉 提交于 2019-12-22 03:44:50
问题 I have an error from the firebase : FIREBASE WARNING: Exception was thrown by user callback. RangeError: Maximum call stack size exceeded I didn't find my mistake. I'm very lost in here, please help. My code looks like this: app.post('/updateCoords', (req, res)=>{ var usrID = req.body.id; var usrCoords = { lat: req.body.lat, long: req.body.long } console.log('userID : '+usrID+' lat : '+usrCoords.lat+' long : '+usrCoords.long); var ref = database.ref('users'); try{ ref.orderByChild('username')

Delete a set of firebase data automatically after assigned time has passed

假装没事ソ 提交于 2019-12-22 01:32:52
问题 I have some data in FirebaseDatabase in which every data set has two properties: startTime and endTime . Here's the data-structure: app -ref -uniqueID1 -key: value -startTime: 1488849333 -endTime: 1488853842 -key: value -uniqueID2 -key: value -startTime: 1488850198 -endTime: 1488853802 -key: value What I want is to deleted the data set when the endTime has passed automatically or when the user opens the app. I have done some research on this topic and found this, but this doesn't seems

Realtime Update between Firebase and HTML Table

醉酒当歌 提交于 2019-12-22 01:22:24
问题 Below code displays data from firebase into table <html> <head> </head> <body > <table style="width:100%;width:100%;" id="ex-table"> <tr id="tr"> <th>Brand</th> <th>Description</th> <th>Item Code</th> <th>Product Category</th> </table> <script src="https://www.gstatic.com/firebasejs/4.1.3/firebase.js"></script> <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script> <script> // Initialize Firebase var config = { apiKey: "AIzaSyB5aqeEmEIB56IvRt4DL8RyOr0JX5Mw3HQ"

How to set multiple layout in FirebaseRecyclerAdapter?

£可爱£侵袭症+ 提交于 2019-12-22 01:09:11
问题 I just make a chat application with Firebase and using RecyclerView in XML and using FirebaseRecyclerAdapter in Android, but the problem is that when I send a message through EditText, the message is sent successfully and show to the right side that I set with Layout as you can see in code below but the problem is that when I close app and restart the message go to left side: mFirebaseRecyclerAdapter = new FirebaseRecyclerAdapter<MessageModel, MessageViewHolder>( MessageModel.class, R.layout

Firebase Date Format - Best Practice to Bridge IoS and Android

有些话、适合烂在心里 提交于 2019-12-22 00:31:04
问题 I built an operational Android app that stores / retrieves data in Firebase. I am now replicating the app in IoS / Swift. On Android I use Java Classes (POJOs) that include Java Date attributes. I store the whole class in Firebase. Below is a screenshot of what Firebase does with a Java Date. Here are my questions: Although it "Works" is Java Date not supported in FB? If Java Date is supported in FB, will a Swift Class with Date in it inter-operate with the Java-based Dates in Firebase? (I am

Firebase - How can I retrieve the objects in a date range?

扶醉桌前 提交于 2019-12-21 23:46:33
问题 I have the next JSON structure in Firebase: { "-KGX6kYg1NO6d9hn-8um" : { "phase" : "A", "timestamp" : "12-18-2015 19:43:37" }, "-KGXOGSxa3vompZX9UO_" : { "phase" : "B", "timestamp" : "03-28-2016 15:28:21" }, "-KMUvszD-vm3Nu02sofd" : { "phase" : "A", "timestamp" : "04-03-2014 03:57:56" } } Is it possible to filter the objects by the timestamp key through a range of date?.. For example, I want to get the objects with timestamp from January 2015 to today date. If not possible, what's the better