Open cbarrios opened 4 years ago
This is interesting. Funny I have been writing twice all through and never even thought about it. Let me go through the code and see how the location write is done
On Sat, 30 May 2020, 18:24 cbarrios, notifications@github.com wrote:
Hi, adding a data object to the setLocation method would mean we would write only once to firestore resulting in less writes and therefore lower costs. The way we have it right now, the user must write the document first and then set the location resulting in 2 writes. The ideal way would be to provide your own data plus the location. Can this be achieved ? Thank you.
— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/suiko1984/geofirestore-android/issues/15, or unsubscribe https://github.com/notifications/unsubscribe-auth/AEISQE4JWTYAAZBDHP5AZ33RUEQLJANCNFSM4NOXR7QA .
Alternatively, we could get a function that returns both l and g fields so that we can add them manually to a document.
I solved it easily by looking at the code but it would be nicer to implement it for ease of use.
GeoHash geoHash = new GeoHash(coordinates.getLatitude(),coordinates.getLongitude()); data.put("g",geoHash.getGeoHashString()); data.put("l",coordinates);
Assume "data" is a regular map (HashMap) object and "coordinates" is a firebase GeoPoint.
I prefer using Pojo classes instead of HashMap. We should definitely expose this functionality though
Hi, adding a data object to the setLocation method would mean we would write only once to firestore resulting in less writes and therefore lower costs. The way we have it right now, the user must write the document first and then set the location resulting in 2 writes. The ideal way would be to provide your own data plus the location. Can this be achieved ? Thank you.