From ba015e657b374935706042429192e01261e0474b Mon Sep 17 00:00:00 2001 From: vanya elizarov Date: Mon, 15 Jan 2024 13:22:28 +0300 Subject: [PATCH] fix LocationManager `minUpdateIntervalMillis` (#1402) * fix LocationManager `minUpdateIntervalMillis` * bump version, update CHANGELOG --- geolocator_android/CHANGELOG.md | 4 ++++ .../baseflow/geolocator/location/LocationManagerClient.java | 1 + geolocator_android/pubspec.yaml | 2 +- 3 files changed, 6 insertions(+), 1 deletion(-) diff --git a/geolocator_android/CHANGELOG.md b/geolocator_android/CHANGELOG.md index 2252b527f..643feb901 100644 --- a/geolocator_android/CHANGELOG.md +++ b/geolocator_android/CHANGELOG.md @@ -1,3 +1,7 @@ +## 4.4.1 + +* Fixes a bug where `getPositionStream` caused an `java.lang.IllegalStateException: passive location requests must have an explicit minimum update interval` because `minUpdateIntervalMillis` property in location request was set to -1 by default + ## 4.4.0 - Adds `color` to `ForegroundNotificationConfig` to set the color of the notification icon. diff --git a/geolocator_android/android/src/main/java/com/baseflow/geolocator/location/LocationManagerClient.java b/geolocator_android/android/src/main/java/com/baseflow/geolocator/location/LocationManagerClient.java index a57054d15..c8b3e59a0 100644 --- a/geolocator_android/android/src/main/java/com/baseflow/geolocator/location/LocationManagerClient.java +++ b/geolocator_android/android/src/main/java/com/baseflow/geolocator/location/LocationManagerClient.java @@ -181,6 +181,7 @@ public void startPositionUpdates( final LocationRequestCompat locationRequest = new LocationRequestCompat.Builder(timeInterval) .setMinUpdateDistanceMeters(distanceFilter) + .setMinUpdateIntervalMillis(timeInterval) .setQuality(quality) .build(); diff --git a/geolocator_android/pubspec.yaml b/geolocator_android/pubspec.yaml index 5b98eb575..62d51482f 100644 --- a/geolocator_android/pubspec.yaml +++ b/geolocator_android/pubspec.yaml @@ -2,7 +2,7 @@ name: geolocator_android description: Geolocation plugin for Flutter. This plugin provides the Android implementation for the geolocator. repository: https://github.com/baseflow/flutter-geolocator/tree/main/geolocator_android issue_tracker: https://github.com/baseflow/flutter-geolocator/issues?q=is%3Aissue+is%3Aopen -version: 4.4.0 +version: 4.4.1 environment: sdk: ">=2.15.0 <4.0.0"