firebase-realtime-database

How to disable already booking slot in android

纵然是瞬间 提交于 2020-01-15 06:28:11
问题 I have to disable already booking slot and show only available slot to user. in recycler view time will be visible from 09:00Am to 09:00Pm. already booked slot should be in disable mode and user can select only available slots. in main activity im storing all the time slot from 09:00AM to 09:00PM and pass into adapter. here in adapter class i want to fetch booked slot from firebase and compare those slots in time arraylist object. getHourarray() ArrayList<TimeSlot>times = new ArrayList

“ref.child is not a function” when adding .orderByChild.StartAt filter

不问归期 提交于 2020-01-15 05:01:11
问题 I have the following code in my controller to go to a firebase database node, loop through the records at that node and return a count of each of the status types into an array (to act as the data for a chartjs chart). The code also waits for changes (edits and deletions) and updates the array accordingly. This all works exactly as I want var ref = new Firebase("https://my-firebase-url/") ref.on('child_added', function (snapshot) { var status = snapshot.val().status.Status; updateStatusCount

How to limit rate of data reads from Firebase?

天涯浪子 提交于 2020-01-15 04:40:32
问题 I would like to limit the rate of data reads per user from the Realtime Database. There are good ways to limit writes like described here but I can't find any solution on how to limit data reads. Can this be done with Security Rules, Cloud Functions or can I limit it somewhere in the Firebase account? I have checked the documentation but can't find the answer. 回答1: This applies to both Realtime Database and Firestore, except with different terminology. (Location == document) You won't be able

Firebase complex query clauses

橙三吉。 提交于 2020-01-15 02:29:28
问题 If I have the following structure in Firebase: { "images": { "first_image": { "url": "https://ima.ge/first_image", "uploader": "john", "timestamp": "1465920841" }, "second_image": { "url": "https://ima.ge/second_image", "uploader": "louis", "timestamp": "1465920987" }, "third_image": { "url": "https://ima.ge/third_image", "uploader": "peter", "timestamp": "1465920990" } }, "votes": { "first_image": { "john": "up", "louis": "down" "francis": "up" }, "second_image": { "john": "up", "louis":

Android-Expected a List while deserializing, but got a class java.util.HashMap

坚强是说给别人听的谎言 提交于 2020-01-14 18:45:34
问题 I want to get all list of restaurants from Firebase in android. Here is my code: boolean delivery; String openTime, closeTime, restaurantName; long likes; List<String> utilities; List<RestaurantModel> listRes; DatabaseReference dataResReference; public RestaurantModel(){ dataResReference = FirebaseDatabase.getInstance().getReference().child("restaurants"); } public List<RestaurantModel> getallRestaurant(){ listRes = new ArrayList<>(); ValueEventListener valueEventListener = new

Android-Expected a List while deserializing, but got a class java.util.HashMap

一世执手 提交于 2020-01-14 18:45:16
问题 I want to get all list of restaurants from Firebase in android. Here is my code: boolean delivery; String openTime, closeTime, restaurantName; long likes; List<String> utilities; List<RestaurantModel> listRes; DatabaseReference dataResReference; public RestaurantModel(){ dataResReference = FirebaseDatabase.getInstance().getReference().child("restaurants"); } public List<RestaurantModel> getallRestaurant(){ listRes = new ArrayList<>(); ValueEventListener valueEventListener = new

Firebase OnSuccessListener is being called when it should fail

大兔子大兔子 提交于 2020-01-14 14:24:30
问题 So I disconnected my internet connection and tested my app. When I add something to the database, I check if it was successfully added using the default OnSuccessListener . However, even when my application is in Airplane mode or there is no internet connection, OnSuccessListener is getting called, and OnFailureListener isn't. This is weird, it shouldn't get called. Code: database.child("blah").child(key).setValue(objects).addOnSuccessListener(new OnSuccessListener<Void>() { @Override public

How to map and reduce child values from FirebaseListObservable

一笑奈何 提交于 2020-01-14 12:18:41
问题 I am trying to sum up test scores, my data looks like this { testResult: { foo: {foo1: x}, {foo2: y} }, { bar: {bar1: z} 'foo' and 'bar' are meaningful subcategories of questions, child-nodes hold questionIDs and corresponding scores. I need to sum up scores ordered by categories. I query the list like this let res = this._dbref.database.list('/bmzi-answers',{ query: { orderByKey: true, equalTo: id } }) and displaying the result with {{ res | async | json }} shows me, that the query works. I

Is there a way to sort the firebaserecyclerview after I calculate value after retrieving data?

Deadly 提交于 2020-01-14 06:49:46
问题 I'm using firebase database to store lat and lng of users. In this manner, Now when I retrieve them in my recyclerview I calculate the distance from my current location to that users location using the following code, private void loadLocationForThisUser(Double lat, Double lng, Double lat1, Double lng1) { //Create location from user coordinates currentUser1 = new Location(""); currentUser1.setLatitude(lat); currentUser1.setLongitude(lng); //Create location from friend coordinates friend1 =

Is there a way to sort the firebaserecyclerview after I calculate value after retrieving data?

烈酒焚心 提交于 2020-01-14 06:48:34
问题 I'm using firebase database to store lat and lng of users. In this manner, Now when I retrieve them in my recyclerview I calculate the distance from my current location to that users location using the following code, private void loadLocationForThisUser(Double lat, Double lng, Double lat1, Double lng1) { //Create location from user coordinates currentUser1 = new Location(""); currentUser1.setLatitude(lat); currentUser1.setLongitude(lng); //Create location from friend coordinates friend1 =