firebase-realtime-database

Firebase always true when checking if data exists

时间秒杀一切 提交于 2019-12-24 09:36:19
问题 I want to check if the data at the current 2 references exists, but it seems it returns always true (always the first Toast ) and i think is not checking if URL_CARS AND URL_PLANES exists , here is what i have: mDatabase.child("Users").child(FirebaseAuth.getInstance().getCurrentUser().getUid()).child("URL_CARS").addValueEventListener(new ValueEventListener() { @Override public void onDataChange(final DataSnapshot dataSnapshotCars) { mDatabase.child("Users").child(FirebaseAuth.getInstance()

How can I register a username in Firebase?

时间秒杀一切 提交于 2019-12-24 09:34:11
问题 I am trying to implement the registration of a username in Firebase since it only gives me methods that are like the createUserWithEmailAndPassword() , but you can not create a username and I do not know how to do it... Below is my register code,but I also want to enter a user name that can use it, when the user publishes something etc, such as the getEmail() method, also being able to have a getUsername() . auth.createUserWithEmailAndPassword(email, password).addOnCompleteListener

Firebase caching ruins order of retrieved children

谁都会走 提交于 2019-12-24 09:22:16
问题 I am building a chat application, and on the conversations/chats list, the last message of a chat is retrieved in order to show it just like in any other messenger app. However, when the chat is opened, all messages of the chat are retrieved using messagesDbRef.orderByChild("time").addChildEventListener(...) and the onChildAdded callback is instantly called for the last message of the chat (the one retrieved on the chats list) which has the highest value for the time field, while all other

ListItem is missing a constructor with no arguments

隐身守侯 提交于 2019-12-24 09:18:46
问题 I got a problem. I am trying to learn a bit about Firebase etc. Today I made RecyclerView which should show Items of my Firebase Database. But if i run it i get this error: E/AndroidRuntime: FATAL EXCEPTION: main Process: com.example.andrejulia.painting, PID: 16777 com.google.firebase.database.DatabaseException: Class com.example.andrejulia.painting.ListItem is missing a constructor with no arguments at com.google.android.gms.internal.zzbqi$zza.zze(Unknown Source) at com.google.android.gms

Firebase Job Dispatcher only called once

时光怂恿深爱的人放手 提交于 2019-12-24 09:15:18
问题 I am new to this, I have implemented a demo referencing from official repo of firebase job dispatching API. I want to run a specific task at every 2 minutes, and call Firebase and fetch a single value from there and update my TextView. What happening is several times I waited 5 mins but nothing is called, I have debugged app and I found that onStartJob() is not getting called. Many times it only called just once and then stops and never called again. Here is the code: DeviceSpaceService

How to use Firebase's ServerValue.TIMESTAMP as a child and set a value to it

我只是一个虾纸丫 提交于 2019-12-24 09:14:51
问题 I want to create a structure like "child1/1510612788766/": key: "quantity", value: 10 "child1/1510612788767/": key: "quantity", value: 4 "child1/1510612788768/": key: "quantity", value: 1 "child2/1510612788710/": key: "quantity", value: 6 "child2/1510612788756/": key: "quantity", value: 8 but when I try: ref.child("child1").child(ServerValue.TIMESTAMP); there is a compilation error on the second child call: Error:(59, 52) error: incompatible types: Map<String,String> cannot be converted to

get user node from Firebase using the uid in Android?

醉酒当歌 提交于 2019-12-24 09:07:30
问题 How can I get the user node using uid generated through: String uid= FirebaseAuth.getInstance().getCurrentUser().getUid(); The JSON is here 回答1: I'm writing this answer according to your request from here but I see that although you are getting the uid from the FirebaseUser object, you are not using it at all. You are still using that random unique key provided by the push() method. So if you want to use the uid , your database structure should look like this: Firebase-root | --- users | ---

Why does returning snapshot.val() in a Promise when using Promise.all not work?

三世轮回 提交于 2019-12-24 08:47:40
问题 I'm writing a Firebase Cloud Function and I'm trying to figure out how Promise.all works. In my code, I pass in an array of database queries and I'm trying the read the resulting array, but I'm only getting garbage: T { A: P { k: Sb { Ka: [Function: vb], ba: [Object] }, aa: P { k: [Object], aa: null, wb: [Object], Bb: '' }, wb: Zc { ld: [Object], ac: [Object] }, Bb: null }, V: R { u: Gd { app: [Object], L: [Object], Ua: [Object], Sc: null, ca: [Object], td: 1, Qa: [Object], va: [Object], qg:

How to update nested data in fire-base database android

三世轮回 提交于 2019-12-24 08:47:06
问题 Nested data in firebase database snap pic Hi guys, I have store data in a real-time database which contains nested children and I had stored this data through using push feature in order to avoid overwriting issue but now the problem I do not know how to fetch particular data which I already highlighted in the snap image. unfortunately, I am struggling in how I can fetch that nested data in order to perform editing or deleting functions. the following are the addUser class and the part of

flutter firebase database and ListView builder issue

≯℡__Kan透↙ 提交于 2019-12-24 08:46:35
问题 I suppose to show each item of my shopList in ListView, but I can't find out the reason why it keep showing the same record. Please help to solve this issue. Here with the code, get data from firebase database. databaseReference.once().then((DataSnapshot snapshot) { Map<dynamic, dynamic> getMap = snapshot.value; getMap.forEach((k, v) { Map<dynamic, dynamic> f = v; shop.key = k; shop.shopName = f["ShopName"]; shop.tel = f["ShopTel"]; shop.address = f["ShopAddress"]; shop.thumbnail = f[