diff --git a/lib/services/gps_service.dart b/lib/services/gps_service.dart index 1535a62..1c30249 100644 --- a/lib/services/gps_service.dart +++ b/lib/services/gps_service.dart @@ -161,6 +161,14 @@ class GpsService { Future startWatching() async { debugLog('[GPS] startWatching() called, current status: $_status'); + // Ensure only one active position stream subscription exists. + // startWatching() can be called multiple times (e.g. after permission flow). + if (_positionSubscription != null) { + debugLog('[GPS] Existing position subscription found, restarting watcher'); + await _positionSubscription?.cancel(); + _positionSubscription = null; + } + // Check if location services are enabled first (system-level setting) final serviceEnabled = await isLocationServiceEnabled(); debugLog('[GPS] Location services check: enabled=$serviceEnabled');