File tree 2 files changed +6
-4
lines changed
firestore/app/src/main/java/com/google/example/firestore 2 files changed +6
-4
lines changed Original file line number Diff line number Diff line change @@ -84,8 +84,9 @@ public void onComplete(@NonNull Task<List<Task<?>>> t) {
84
84
// We have to filter out a few false positives due to GeoHash
85
85
// accuracy, but most will match
86
86
GeoLocation docLocation = new GeoLocation (lat , lng );
87
- double distance = GeoFireUtils .getDistanceBetween (docLocation , center );
88
- if (distance <= radiusInKm ) {
87
+ double distanceInM = GeoFireUtils .getDistanceBetween (docLocation , center );
88
+ double distanceInKm = distanceInM / 1000 ;
89
+ if (distanceInKm <= radiusInKm ) {
89
90
matchingDocs .add (doc );
90
91
}
91
92
}
Original file line number Diff line number Diff line change @@ -66,8 +66,9 @@ class SolutionGeoqueries {
66
66
// We have to filter out a few false positives due to GeoHash
67
67
// accuracy, but most will match
68
68
val docLocation = GeoLocation (lat, lng)
69
- val distance = GeoFireUtils .getDistanceBetween(docLocation, center)
70
- if (distance <= radiusInKm) {
69
+ val distanceInM = GeoFireUtils .getDistanceBetween(docLocation, center)
70
+ val distanceInKm = distanceInM / 1000
71
+ if (distanceInKm <= radiusInKm) {
71
72
matchingDocs.add(doc)
72
73
}
73
74
}
You can’t perform that action at this time.
0 commit comments