From c39b32f0942507d370f169db3beabdba9268bb2f Mon Sep 17 00:00:00 2001 From: Maurits van Beusekom Date: Mon, 15 Jan 2024 14:16:41 +0100 Subject: [PATCH] Release plugin binding when activity is detached. --- geolocator_android/CHANGELOG.md | 6 +++++- .../main/java/com/baseflow/geolocator/GeolocatorPlugin.java | 4 ++++ geolocator_android/pubspec.yaml | 2 +- 3 files changed, 10 insertions(+), 2 deletions(-) diff --git a/geolocator_android/CHANGELOG.md b/geolocator_android/CHANGELOG.md index 643feb901..70092f7e2 100644 --- a/geolocator_android/CHANGELOG.md +++ b/geolocator_android/CHANGELOG.md @@ -1,6 +1,10 @@ +## 4.4.2 + +* Fixes bug where Android activity is leaked when embedded in native Android application. + ## 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 +* 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 diff --git a/geolocator_android/android/src/main/java/com/baseflow/geolocator/GeolocatorPlugin.java b/geolocator_android/android/src/main/java/com/baseflow/geolocator/GeolocatorPlugin.java index 9d16cdede..25b9ddabf 100644 --- a/geolocator_android/android/src/main/java/com/baseflow/geolocator/GeolocatorPlugin.java +++ b/geolocator_android/android/src/main/java/com/baseflow/geolocator/GeolocatorPlugin.java @@ -189,5 +189,9 @@ private void dispose() { if (foregroundLocationService != null) { foregroundLocationService.setActivity(null); } + + if (pluginBinding != null) { + pluginBinding = null; + } } } diff --git a/geolocator_android/pubspec.yaml b/geolocator_android/pubspec.yaml index 62d51482f..0e62a4563 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.1 +version: 4.4.2 environment: sdk: ">=2.15.0 <4.0.0"