firebase-realtime-database

Firebase Database Exception while retrieving data from Firebase database

北城余情 提交于 2019-12-25 09:30:00
问题 I have a Firebase Database as shown below. I am trying to retrieve this episode data but always getting error users: { Fcm_id: "c68y2j3bwis:APA91bFABxC6W5FmYVCOSmgJiB_-UEqnrmQ...", Name: "Vikas Kumar", episodes:{ 0: "-Kno0IYdlSjjfFsXkGQ7", 1: "-Kno0IYdlSjjfFsXkGQ8" }, gender:Male, age:14, email:"vikas@gmail.com", } this is the user POJO class in which I am creating a HashMap public class User implements Serializable{ private String Name; private String email; private String gender; private

Firebase Database Structure

无人久伴 提交于 2019-12-25 09:26:02
问题 I am working on an application about restaurant. But having some trouble with the Firebase database structure. The database structure of my code is like this: restaurants { AutoID { name: "nnnnn", phone:"88888888" } AutoID { name: "nnnnn", phone:"88888888" } image { AutoID: URL AutoID: URL } } How can I change the structure to become like this: restaurants { AutoID { name: "nnnnn", phone:"88888888", image: URL } AutoID { name: "nnnnn", phone:"88888888", image: URL } The current code are:

Does Firebase have built-in functionality to retrieve random items?

ぐ巨炮叔叔 提交于 2019-12-25 09:25:03
问题 I'm planning on doing a Firebase project with thousands (probably tens of thousands) of items in the realtime database, and need to be able to both order, filter and pick a random item. I can of course do the randomization on the client, but if Firebase already has this functionality, it would be better. I have done some searching, and most of the related hits are 2-3 years old and states that this is not available. Does anyone know if the support is here now in late 2016? 来源: https:/

Aggregate values coming from firebase database

∥☆過路亽.° 提交于 2019-12-25 09:25:01
问题 I have to calculate the total price from a bunch of products stored in firebase. Since in firebase each product will be returned separately, how can I know when the total is completely calculated? For example: var total = 0; firebaseApp.database().ref('/products/').once('value') .then(function(snapshot) { var product = snapshot.val(); total += product.price; }); If I have 12 products, the total can only be returned once all those products are retrieved from the database so it's not possible

'addListenerForSingleValueEvent' in populateViewHolder method of FirebaseRecyclerAdapter gets called whenever data changes under Firebase reference

半腔热情 提交于 2019-12-25 09:24:47
问题 I'm using FirebaseRecyclerAdapter in my app and trying to populate it by fetching some data inside it's populateViewHolder() method and then assigning values to different parameters. Here's my code: private void attachRecyclerViewAdapter() { Query lastFifty = aReference.child(requestID).limitToFirst(50); mRecyclerViewAdapter = new FirebaseRecyclerAdapter<AModelClass, AModelClass.ViewHolder>( AModelClass.class, R.layout.a_layout, AModelClass.ViewHolder.class, lastFifty) { @Override protected

Add annotation after retrieving users latitude and longitude from Firebase

心已入冬 提交于 2019-12-25 09:22:32
问题 I am trying to add a mapView annotation of all the online user after retrieving their latitude and longitude from Firebase. I am able to print it as an optional or as a CLLocationDegrees aka Double, but when I try to add it into my user.userAnnotation attribute I get a fatal error. This is what I am printing: this is the users lat Optional(19.435477800000001) this is the user latitude in CLLocationDegrees 19.4354778 fatal error: unexpectedly found nil while unwrapping an Optional value And

Can't get value from firebase

≯℡__Kan透↙ 提交于 2019-12-25 09:21:17
问题 I have a problem when i try to get value of isBusy property from my database. A used breakpoints and it even doesn't go to instruction where i assign a value for isBusy, it assigns empty string and goes to else condition. if docChild == 0 { let selectedDoctor = Doctors.doc1 var isBusy = String() databaseHandle = reference.child(selectedDoctor).child(dateChild).child(timeChild).child(ReservationFields.isBusy).observe(.childAdded, with: { (snapshot) in isBusy = snapshot.value as! String }) if

After retrieving data from Firebase, how to send retrieved data from one view controller to another view controller?

可紊 提交于 2019-12-25 09:17:37
问题 This is my table created in Firebase here. I have a search button. The button action will be at first it will fetch data from firebase and then it will send it to another view controller and will show it in a table view. but main problem is that before fetching all data from Firebase self.performSegueWithIdentifier("SearchResultPage", sender: self ) triggers and my next view controller shows a empty table view. Here was my effort here. From this post here I think that my code is not placed

Firebase and Java Play! Framework not fully working together

最后都变了- 提交于 2019-12-25 09:17:13
问题 I am trying to add Firebase to my Java Play! Framework project. I followed the steps here https://firebase.google.com/docs/admin/setup. There is very little documentation on the server setup. Lots on android, but it is not too helpful. The Problem I am able to initialize the firebase library and even get the first call to the database to return successfully, but after that all of the next calls just hang. They never return in ether the onCancelled or onDataChange blocks. I don't get any

How to retrieve value from the highest/last level node using 'ChildEventListener' from Firebase?

∥☆過路亽.° 提交于 2019-12-25 09:15:41
问题 I have several strings stored under specific reference: mReference.child(rID).child(userID2) which I want to retrieve using childEventListener as I am doing some task also when these string gets removed and that is only possible with onChildRemoved of ChildEventListener . Here's what I have tried: mReference.child(rID).child(userID2).addChildEventListener(new ChildEventListener() { @Override public void onChildAdded(DataSnapshot dataSnapshot, String s) { Log.d("dataHEre", dataSnapshot