Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions lib/services/gps_service.dart
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,14 @@ class GpsService {
Future<void> 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');
Expand Down