firebase-realtime-database

Storing a list of ids in Firebase

不羁岁月 提交于 2020-05-29 06:50:08
问题 I can't figure out how to solve this issue with firebase : I have users, each user has posts, each post has an id generated by firebase, how can I store these ids in a user node ? I'm using string,concatenating them, parsing them in my js app. Basically treating them as a csv file. But i guess that's a very ugly solution What would be the way to store this kind of data ? Edit: UserID : Username = "User Name" Posts = "id1,id2,id3,id4" When a user has a new post, I use a transaction to append a

Most efficient way to count children with Firebase Database

烂漫一生 提交于 2020-05-28 09:37:05
问题 Currently i am doing it like this: DatabaseReference reference = FirebaseDatabase.DefaultInstance.GetReference("Leaders").Child("List1"); reference.GetValueAsync().ContinueWith(task => { int totalChildren = (int)task.Result.ChildrenCount; //Do more stuff } I thought, why get whole Snapshot to count how many children. Any different way without fetching whole Snapshot? 回答1: Firebase does not have a built-in count operator. So you'll either have to download all child nodes to count them (as you

Most efficient way to count children with Firebase Database

做~自己de王妃 提交于 2020-05-28 09:36:25
问题 Currently i am doing it like this: DatabaseReference reference = FirebaseDatabase.DefaultInstance.GetReference("Leaders").Child("List1"); reference.GetValueAsync().ContinueWith(task => { int totalChildren = (int)task.Result.ChildrenCount; //Do more stuff } I thought, why get whole Snapshot to count how many children. Any different way without fetching whole Snapshot? 回答1: Firebase does not have a built-in count operator. So you'll either have to download all child nodes to count them (as you

Android Firebase gets updated, child layout gets called too weird issue

夙愿已清 提交于 2020-05-28 08:23:27
问题 Overview: Using child layout within my MainActivity (to accept and update values into firebase database) Whenever firebase gets updated, my child layout gets called too (which I am usually launching on tap of button to accept and update data into firebase database) I've cross-checked, if I don't call updateData() then firebase never gets hit and everything works so smoothly (I mean never launch my child layout unnecessarily) So, my concern is, how can I control on a launch of child layout,

Android Firebase gets updated, child layout gets called too weird issue

有些话、适合烂在心里 提交于 2020-05-28 08:22:07
问题 Overview: Using child layout within my MainActivity (to accept and update values into firebase database) Whenever firebase gets updated, my child layout gets called too (which I am usually launching on tap of button to accept and update data into firebase database) I've cross-checked, if I don't call updateData() then firebase never gets hit and everything works so smoothly (I mean never launch my child layout unnecessarily) So, my concern is, how can I control on a launch of child layout,

How to get User data Via User Model from firebase?

你离开我真会死。 提交于 2020-05-28 07:39:12
问题 I tried very hard; but, I can't able to get user data via user Model in Profile Fragment in my app. Here is the code which I have written in my project. ProfileFragment.java reference.addValueEventListener(new ValueEventListener() { @Override public void onDataChange(@NonNull DataSnapshot dataSnapshot) { User user = dataSnapshot.getValue(User.class); assert user != null; username.setText(user.getUserName()); useremail.setText(user.getUserEmail()); userphone.setText(user.getUserPhone());

Error:Execution failed for task ':app:packageDebug'. > !zip.isFile()

蹲街弑〆低调 提交于 2020-05-24 21:10:10
问题 @UPDATE Thank you very much. Now at least there are no errors. But it's still a far cry from how it worked before - how it should work. Now, the database looks ... strange. I think that something is still wrong with this gradle. It should not look like. According to the java code in the database will be user and its data (name, email, date of account creation, id avatar) In the application at the site next to the avatar you should display the name. Unfortunately, as you can see nothing

Android Kotlin firebase.database.DatabaseException: No properties to serialize found on class

你说的曾经没有我的故事 提交于 2020-05-24 07:59:08
问题 I have followed the advice of other SO solution: 1. Make my class Serializeable 2. Have a default constructor for Firebase 3. Update my proguard rules (Not sure about this one) And still I get the above error, any ideas? package org.sherman.android.stub_firebase.Models import java.io.Serializable /** * Created by fyi2 on 2/21/18. */ class User(displayName:String, email:String, photoUrl:String, userId:String) : Serializable { constructor(): this("","","","") } New Class Definition: class User

using the image assigned to userprofile in firebase and attachine it to profile page

自作多情 提交于 2020-05-24 05:48:11
问题 I have been looking online everywhere to help me out here but I cannot figure this out. The code below says that allows for the image to get stored in the firebase database when the user registers: func uploadProfileImage(_ image: UIImage, completion: @escaping ((_ url: URL?)->())){ guard let uid = Auth.auth().currentUser?.uid else {return} let storageRef = Storage.storage().reference().child("user/\(uid)") guard let imageData = image.jpegData(compressionQuality: 0.75 ) else {return} let

How to set String value of date time on xAxis BarChart MPAndroidChart

霸气de小男生 提交于 2020-05-24 05:31:33
问题 I'm trying to show date time on X-Axis for my bar chart. I got this data from my UNIX timestamp firebase database. I have been trying to convert this UNIX timestamp to a human-readable date and then show this on my Axis. From what I know, BarEntry constructor doesn't support data type like String. So, I should use xAxis.setValueFormatter() to show the date. I have tried to use a formatter but it seems wrong like overlaps chart and the X-Axis showing incorrect results. Here is my formatter: