firebase / geofire-java

GeoFire for Java - Realtime location queries with Firebase
MIT License
670 stars 271 forks source link

Save Additional Items along with GeoFire Data in Firebase #71

Closed jaykeerti closed 6 years ago

jaykeerti commented 7 years ago

Can someone please help me on how to store extra data with Geofire like user details and some additional properties?

andretietz commented 7 years ago

We need this too! How can I get more data than the key of an item? In your example (SFVehicles) you show positions only. What if all the items are a bit different? I would not like to have all items in a map and only show them when they enter the screen (or radius). Then I wouldn't need geofire anymore and would show all. But I would like to avoid loading all data!

Is this possible atm?

brezinajn commented 7 years ago

@andretietz You probably should keep different types of items in different lists /something/players /something/cars etc.. Regarding having additional data at geofire. I used different approach. Instead of adding data to geofire I added geofire to my data :). Kotlin example:

data class Point(val owner: UserKey,
                 val name: String,
                 val description: String?,
                 val type: PointType,
                 val g: String,
                 val l: List<Double>) {
    constructor(owner: UserKey, name: String, description: String?, type: PointType, lat: Double, lng: Double) :
            this(owner, name, description, type, GeoHash(lat, lng).geoHashString, listOf(lat, lng))

I had my reasons for mixing geofire and my data together. But in most situations you are better with those two separated.

vanniktech commented 6 years ago

Can't you just use a reference key and then store the data somewhere else?

vanniktech commented 6 years ago

Should we close this since it's inactive? If we ever run into this again we can create a new issue and put some more effort / dedication into this.

vanniktech commented 6 years ago

This can be closed @samtstern

samtstern commented 6 years ago

@vanniktech thank you!