From ac477e939b12c134effc8d295f65ff464d05bf1b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Chudziak?= Date: Thu, 6 Apr 2023 13:42:20 +0200 Subject: [PATCH] chore: fix a bug with negative distance filter passed to options (#246) --- .../geolocation/PlayServicesLocationManager.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/android/src/main/java/com/reactnativecommunity/geolocation/PlayServicesLocationManager.java b/android/src/main/java/com/reactnativecommunity/geolocation/PlayServicesLocationManager.java index 7dedb91..4b9e004 100644 --- a/android/src/main/java/com/reactnativecommunity/geolocation/PlayServicesLocationManager.java +++ b/android/src/main/java/com/reactnativecommunity/geolocation/PlayServicesLocationManager.java @@ -128,7 +128,9 @@ private void checkLocationSettings(ReadableMap options, LocationCallback locatio locationRequest.setFastestInterval(locationOptions.fastestInterval); } locationRequest.setExpirationDuration((long) locationOptions.maximumAge); - locationRequest.setSmallestDisplacement(locationOptions.distanceFilter); + if (locationOptions.distanceFilter >= 0) { + locationRequest.setSmallestDisplacement(locationOptions.distanceFilter); + } locationRequest.setPriority( locationOptions.highAccuracy ? LocationRequest.PRIORITY_HIGH_ACCURACY : LocationRequest.PRIORITY_LOW_POWER );