Baseflow / Baseflow/flutter-geolocator

[Bug]: after some time no GPS available

Open
#1,298 0 comments 3 reactions 0 assignees View on GitHub
background-foreground-location P2 platform: android type: bug
Dominant language
Dart
Stars
1.3k
Forks
803
Avg merge
8h 16m
Merged PRs (30d)
1

Description

### Please check the following before submitting a new issue.

- [X] I have searched the [existing issues](https://github.com/baseflow/flutter-geolocator/issues).
- [X] I have carefully [read the documentation](https://github.com/Baseflow/flutter-geolocator/blob/main/geolocator/README.md) and verified I have added the required platform specific configuration.

### Please select affected platform(s)

- [X] Android
- [ ] iOS
- [ ] Linux
- [ ] macOS
- [ ] Web
- [ ] Windows

### Steps to reproduce

trigger every 15s the method: getCurrentPosition() or listen on the location stream.

after some time (1-2h) we don't receive position updates when the phone is locked. We receive timeouts. what can i do?
when i unlocked the phone, then i receive all positions imediately. My Service is running in a foreground service.

### Expected results

actual GPS position

### Actual results

timeout errors

### Code sample

Code sample

```dart
Position? position = await GeolocatorPlatform.instance
.getCurrentPosition(locationSettings: const LocationSettings(accuracy: LocationAccuracy.bestForNavigation, timeLimit: Duration(seconds: 30)));
```

### Screenshots or video

Screenshots or video demonstration

[Upload media here]

### Version

9.0.2

### Flutter Doctor output

Doctor output

```console
[√] Flutter (Channel stable, 3.10.5, on Microsoft Windows [Version 10.0.19044.3086], locale en-CH)
• Flutter version 3.10.5 on channel stable at C:\Flutter
• Upstream repository https://github.com/flutter/flutter.git
• Framework revision 796c8ef792 (7 weeks ago), 2023-06-13 15:51:02 -0700
• Engine revision 45f6e00911
• Dart version 3.0.5
• DevTools version 2.23.1

[√] Windows Version (Installed version of Windows is version 10 or higher)

[√] Android toolchain - develop for Android devices (Android SDK version 30.0.3)
• Android SDK at C:\Users\Roy\AppData\Local\Android\Sdk
• Platform android-33, build-tools 30.0.3
• ANDROID_HOME = C:\Users\Roy\AppData\Local\Android\Sdk
• Java binary at: C:\Program Files\Android\Android Studio\jbr\bin\java
• Java version OpenJDK Runtime Environment (build 17.0.6+0-b2043.56-9586694)
• All Android licenses accepted.

[√] Chrome - develop for the web
• Chrome at C:\Program Files\Google\Chrome\Application\chrome.exe

[√] Visual Studio - develop for Windows (Visual Studio Professional 2019 16.11.2)
• Visual Studio at C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional
• Visual Studio Professional 2019 version 16.11.31624.102
• Windows 10 SDK version 10.0.20348.0

[√] Android Studio (version 2022.2)
• Android Studio at C:\Program Files\Android\Android Studio
• Flutter plugin can be installed from:
https://plugins.jetbrains.com/plugin/9212-flutter
• Dart plugin can be installed from:
https://plugins.jetbrains.com/plugin/6351-dart
• Java version OpenJDK Runtime Environment (build 17.0.6+0-b2043.56-9586694)

[√] VS Code, 64-bit edition (version 1.78.2)
• VS Code at C:\Program Files\Microsoft VS Code
• Flutter extension version 3.68.0

[√] Connected device (4 available)
• SM A715F (mobile) • R58R13LKH1P • android-arm64 • Android 13 (API 33)
• Windows (desktop) • windows • windows-x64 • Microsoft Windows [Version 10.0.19044.3086]
• Chrome (web) • chrome • web-javascript • Google Chrome 115.0.5790.110
• Edge (web) • edge • web-javascript • Microsoft Edge 114.0.1823.79

[√] Network resources
• All expected network resources are available.

• No issues found!
```

Contributor guide

Open the contributing guide

Research direction

Start by reproducing the report on Android 13 with geolocator 9.0.2: call getCurrentPosition() every 15 seconds or use the location stream while the phone is locked and the foreground service is running. Compare the timeout behavior with the immediate updates after unlocking; done requires identifying a reproducible cause and a verified resolution.

Written by the indexing model from the issue text.

Assessment

Tech stack
android, dart, flutter
Domain
mobile
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.