firebase-realtime-database

Firebase - set priority when doing an update/fanout to several nodes

眉间皱痕 提交于 2020-01-04 01:32:46
问题 I'm writing to several parts/nodes of my Firebase database in one update. Is it possible to set the priority of a node when doing this? Example: firebaseRef.update([ "/some/node/": "value", "/some/other/node": "other value" ]) What if I want to set the priority of the node at "/some/other/node" at the same time. Is that possible? Something like: firebaseRef.update([ "/some/node/": "value", "/some/other/node": { value: "other value", priority: 0 - Date.now() } ]) 回答1: You almost got it, the

Firebase - set priority when doing an update/fanout to several nodes

孤人 提交于 2020-01-04 01:32:41
问题 I'm writing to several parts/nodes of my Firebase database in one update. Is it possible to set the priority of a node when doing this? Example: firebaseRef.update([ "/some/node/": "value", "/some/other/node": "other value" ]) What if I want to set the priority of the node at "/some/other/node" at the same time. Is that possible? Something like: firebaseRef.update([ "/some/node/": "value", "/some/other/node": { value: "other value", priority: 0 - Date.now() } ]) 回答1: You almost got it, the

Firebase-Android, Fail to save data after long time idle

百般思念 提交于 2020-01-03 17:47:16
问题 This question is relative to this issue Firebase-Android, How to sync data when resume after connection lost? Step-by-step is: First I login using email method in Auth Activity In Timeline activity I add an record. Everything looks good. But if I minimize app for about 24 hours, then resume application at timeline activity and add new record, I got error: "java.lang.Exception: Permission denied". I'm sure nothing wrong with new data, but: path / { read() = true; write() = isSignedIn(); }

How to query a specific child value in multiple nodes with firebase android

自古美人都是妖i 提交于 2020-01-03 16:53:46
问题 I want to query a specific child value in multiple nodes, to populate them in a list view by FirebaseListAdapter. I'm passing a firebase reference to FirebaseListAdapter method to listen to, which is in red rectangle in the picture below, And I want to populate in the list view the values of the "category" key only. which are in green rectangle in the picture below. My code is here: catgoryList = (ListView) findViewById(R.id.catList); rootRef = FirebaseDatabase.getInstance().getReference();

Javascript variable is an array of objects but can't access the elements

孤人 提交于 2020-01-03 16:52:35
问题 I am using Firebase database and Javascript, and I have code that will get each question in each category. I have an object called category will contain the name, the questions, and the question count, then it will be pushed into the list of categories (questionsPerCategory). Inside the the callback function I just do console.log(questionsPerCategory) . It prints the object (array) that contains the categories and questions. Now my problem is that when I do console.log(questionsPerCategory[0]

How to query a specific child value in multiple nodes with firebase android

泄露秘密 提交于 2020-01-03 16:50:07
问题 I want to query a specific child value in multiple nodes, to populate them in a list view by FirebaseListAdapter. I'm passing a firebase reference to FirebaseListAdapter method to listen to, which is in red rectangle in the picture below, And I want to populate in the list view the values of the "category" key only. which are in green rectangle in the picture below. My code is here: catgoryList = (ListView) findViewById(R.id.catList); rootRef = FirebaseDatabase.getInstance().getReference();

java.util.zip.ZipException: duplicate entry with firebase

ⅰ亾dé卋堺 提交于 2020-01-03 11:52:43
问题 I am building an application with firebase but getting the Duplicate class error. I have checked all dependencies, but I'm not able to figure out where did I have two version of firebase libs. Error: Execution failed for task ':app:transformClassesWithJarMergingForDebug'. com.android.build.api.transform.TransformException: java.util.zip.ZipException: duplicate entry: com/google/firebase/iid/zzb$1.class buildscript { repositories { maven { url 'https://maven.fabric.io/public' } } dependencies

java.util.zip.ZipException: duplicate entry with firebase

不羁岁月 提交于 2020-01-03 11:51:11
问题 I am building an application with firebase but getting the Duplicate class error. I have checked all dependencies, but I'm not able to figure out where did I have two version of firebase libs. Error: Execution failed for task ':app:transformClassesWithJarMergingForDebug'. com.android.build.api.transform.TransformException: java.util.zip.ZipException: duplicate entry: com/google/firebase/iid/zzb$1.class buildscript { repositories { maven { url 'https://maven.fabric.io/public' } } dependencies

How to copy a childNode from one node to another?

寵の児 提交于 2020-01-03 08:39:30
问题 SITUATION: I would need to download the childNode, then set() it into the other node. Problem is I want to do this only once the childNode's score attribute reaches 100. Where and when should I check if posts have a score of 100 or more and how would I copy them to the new index only once ? WHAT I THOUGHT OF: When a post is loaded, check for it's score. If it's >= 100, check in the database if that's the case. Then push the node to the new index. PROBLEM: How would I prevent the node from

Cloud Functions for Firebase timeout

一个人想着一个人 提交于 2020-01-03 08:32:08
问题 Simple cloud function to get database data is not working. getusermessage() is not working Error: Function execution took 60002 ms, finished with status: 'timeout' Index.JS for getting database result. const functions = require('firebase-functions'); const admin = require('firebase-admin'); admin.initializeApp(functions.config().firebase); const cors = require('cors')({origin: true}); // Take the text parameter passed to this HTTP endpoint and insert it into the // Realtime Database under the