From 21a5bb3feb6a96fef5931b2c160be6fe741244a8 Mon Sep 17 00:00:00 2001 From: FabianLars Date: Thu, 25 Sep 2025 15:21:45 +0200 Subject: [PATCH] fix(geolocation): use timeout for min,max,interval on android --- .changes/geolocation-android-timeout.md | 6 ++++++ plugins/geolocation/android/src/main/java/Geolocation.kt | 4 ++-- 2 files changed, 8 insertions(+), 2 deletions(-) create mode 100644 .changes/geolocation-android-timeout.md diff --git a/.changes/geolocation-android-timeout.md b/.changes/geolocation-android-timeout.md new file mode 100644 index 0000000000..dc3d952e25 --- /dev/null +++ b/.changes/geolocation-android-timeout.md @@ -0,0 +1,6 @@ +--- +geolocation: patch +geolocation-js: patch +--- + +On Android, use the `timeout` value for `setMinUpdateIntervalMillis`, `setMaxUpdateDelayMillis` and `setIntervalMillis` instead of just `minUpdateInterval`. diff --git a/plugins/geolocation/android/src/main/java/Geolocation.kt b/plugins/geolocation/android/src/main/java/Geolocation.kt index 96bcf042bb..444711a4c3 100644 --- a/plugins/geolocation/android/src/main/java/Geolocation.kt +++ b/plugins/geolocation/android/src/main/java/Geolocation.kt @@ -91,9 +91,9 @@ public class Geolocation(private val context: Context) { val lowPrio = if (networkEnabled) Priority.PRIORITY_BALANCED_POWER_ACCURACY else Priority.PRIORITY_LOW_POWER val prio = if (enableHighAccuracy) Priority.PRIORITY_HIGH_ACCURACY else lowPrio - val locationRequest = LocationRequest.Builder(10000) + val locationRequest = LocationRequest.Builder(timeout) .setMaxUpdateDelayMillis(timeout) - .setMinUpdateIntervalMillis(5000) + .setMinUpdateIntervalMillis(timeout) .setPriority(prio) .build()