firebase-realtime-database

Android : Get current date and time from firebase

倾然丶 夕夏残阳落幕 提交于 2020-02-28 05:04:29
问题 I am developing a simple game where users get daily bonus.I want to get current date and time from firebase server as i don't want to rely on device time which could be manipulated. I went through ServerValue.TIMESTAMP in firebase but don't know how to use it.It returns a map with value as timestamp.How can i convert that timestamp into date.I want to get Today's date from firebase when ever user clicks on daily bonus. 回答1: Since Firebase Introduced Callable Functions you can use it in your

ValueEventListener not Working as expected

谁说我不能喝 提交于 2020-02-25 05:21:05
问题 I am trying to display the data stored in Firebase, in AutoCompleteTextView's Dropdown. For this purpose, I am using the ValueEventListener . According to the documentation of ValueEventListener , You can use the onDataChange() method to read a static snapshot of the contents at a given path, as they existed at the time of the event. This method is triggered once when the listener is attached and again every time the data, including children, changes. Unfortunately, in my case onDataChange()

Scala case classes with new firebase-server-sdk

泪湿孤枕 提交于 2020-02-24 20:59:11
问题 Does the new server SDK for firebase firebase-server-sdk (3.0.1) support Scala case class deserialization? The previous firebase java sdk used jackson which you could bolt in a scala module to support case classes. It's unclear if its possible to do something similar with the new SDK? Does it use Gson or some custom class mapper? In the simplest example: case class Person(firstName: String, lastName: String, age: Int) With a Firebase listener setup such as: var options = new FirebaseOptions

Firebase (NoSQL): Denormalization vs Indexing

不羁岁月 提交于 2020-02-24 12:43:44
问题 Assume that I want to write a blogging app. Should I prefer one of the following two options? I would prefer to have as much "single source of truth" as possible, but I am still not sure whether that preference comes from my background in SQL. Option 1 (Denormalization): Posts: { post_1: { title: "hello", body: "hi there!", uid: "user_1", comments: { comment_1: { body: "hi I commented", uid: "user_2", }, comment_2: { body: "bye I commented", uid: "user_2", }, } } } Users: { user_1: { uid:

Firebase (NoSQL): Denormalization vs Indexing

半城伤御伤魂 提交于 2020-02-24 12:42:08
问题 Assume that I want to write a blogging app. Should I prefer one of the following two options? I would prefer to have as much "single source of truth" as possible, but I am still not sure whether that preference comes from my background in SQL. Option 1 (Denormalization): Posts: { post_1: { title: "hello", body: "hi there!", uid: "user_1", comments: { comment_1: { body: "hi I commented", uid: "user_2", }, comment_2: { body: "bye I commented", uid: "user_2", }, } } } Users: { user_1: { uid:

Search in Firebase based on distance

﹥>﹥吖頭↗ 提交于 2020-02-24 11:46:28
问题 I'm migrating an application that was using Mysql to firebase, and I managed to migrate it almost all, just missing the part of search, I did not quite understand how it works. I'm trying to do this query below in firebase. SELECT *, (6371 * acos( cos(radians(?)) * cos(radians(latitude)) * cos(radians(?) - radians(longitude)) + sin(radians(?)) * sin(radians(latitude)) )) AS distance FROM usuario ORDER BY distance What I'm trying to do is pass the latitude and longitude of my User to firebase

Polymer 1.x + Firebase 2.x: How to push or put data to Firebase using Polymerfire?

会有一股神秘感。 提交于 2020-02-24 11:33:04
问题 Using Polymerfire, I want to add new nodes to a Firebase without overwriting data. (I call this push or put behavior.) In other words. I want to start with this: State A my-app | - emails | + email1@example,com + email2@example,com And finish with this. State B my-app | - emails | + email1@example,com + email2@example,com + email3@example,com + email4@example,com But when I start with State A and do this: <firebase-document id="doc" app-name="app" data="{{data}}"> </firebase-document> ...

Get nearest users within a circle by current location node js

纵饮孤独 提交于 2020-02-22 07:17:51
问题 I'm explaining with an example to achieve my result. I have a users table. Each user has their location with latitude and longitude on the database. I'm using firebase database. So the DB looks like: users { user-id{ location{ latitude longitude } } } I need to find users within a circle using my current location. I've looked into geolib and found a method isPointInCircle . But using this, we need to iterate users data and needs to call this method on each loop. I need to avoid this multiple

Get nearest users within a circle by current location node js

时光总嘲笑我的痴心妄想 提交于 2020-02-22 07:17:25
问题 I'm explaining with an example to achieve my result. I have a users table. Each user has their location with latitude and longitude on the database. I'm using firebase database. So the DB looks like: users { user-id{ location{ latitude longitude } } } I need to find users within a circle using my current location. I've looked into geolib and found a method isPointInCircle . But using this, we need to iterate users data and needs to call this method on each loop. I need to avoid this multiple

Firebase android how to prevent FirebaseRecyclerAdapter automatically updating?

旧街凉风 提交于 2020-02-20 08:53:42
问题 I have a FirebaseRecyclerAdapter which I do not want to keep updating the RecyclerView . This is because I have it so it populates the view with items based on how many 'views' they have in the database. The problem is, if other people view the items, the list you see in the app will keep changing order. Is there a way to stop the recycler adapter from constantly listening for data changes or will I have to go about this another way? Any help is greatly appreciated, thanks. 回答1: The adapters