Skip to content

Commit

Permalink
[STAD-513] Set accuracy to fix distance on Samsung Android 10 (#278)
Browse files Browse the repository at this point in the history
  • Loading branch information
hb0 authored May 15, 2023
1 parent a5ede94 commit fab52d7
Showing 1 changed file with 7 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,13 @@ class DefaultDistanceCalculation : DistanceCalculationStrategy {
previousLocation.longitude = lastLocation.lon
nextLocation.latitude = newLocation.lat
nextLocation.longitude = newLocation.lon
// w/o `accuracy`, `distanceTo()` returns `0` on Samsung Galaxy S9 Android 10 [STAD-513]
if (lastLocation.accuracy != null) {
previousLocation.accuracy = lastLocation.accuracy!!.toFloat()
}
if (newLocation.accuracy != null) {
nextLocation.accuracy = newLocation.accuracy!!.toFloat()
}
return previousLocation.distanceTo(nextLocation).toDouble()
}

Expand Down

0 comments on commit fab52d7

Please sign in to comment.