[Bug]: Geolocator.getCurrentPosition hangs after app restart · Issue #1687 · Baseflow/flutter-geolocator · GitHub
More Web Proxy on the site http://driver.im/
You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have carefully read the documentation and verified I have added the required platform specific configuration.
Please select affected platform(s)
Android
iOS
Linux
macOS
Web
Windows
Steps to reproduce
In an Android app, request GeoLocator.getCurrentPosition().
First time is fast. I use "medium".
Then, either kill the app and re-open, or, do a hot reload if debugging.
Second time, or perhaps one or two times after, the app will hang during getCurrentPosition.
Expected results
It should again work fast after killing the app and restarting.
Actual results
After opening the app, closing the app, then re-opening, (maybe cycle that 1-3 times), Geolocator will hang for 16-20 seconds before finally getting a position.
Code sample
Code sample
Future<Position> getCurrentLocation() async {
const locationSettings =LocationSettings(
accuracy:LocationAccuracy.medium, // Medium accuracy (100-500m)
);
final position =awaitGeolocator.getCurrentPosition(
locationSettings: locationSettings,
);
return position;
}
Screenshots or video
Screenshots or video demonstration
[Upload media here]
Version
13.0.2
Flutter Doctor output
Doctor output
[√] Flutter (Channel beta, 3.32.0-0.1.pre, on Microsoft Windows [Version 10.0.22], locale en-US) [778ms] • Flutter version 3.32.0-0.1.pre on channel beta at C:\Flutter • Upstream repository https://github.com/flutter/flutter.git • Framework revision eeb81b9a8a (4 days ago), 2025-04-11 12:11:52 -0700 • Engine revision 72ee26e314 • Dart version 3.8.0 (build 3.8.0-278.1.beta) • DevTools version 2.45.0[√] Windows Version (11 Home 64-bit, 22H2, 2009) [4.9s][√] Android toolchain - develop for Android devices (Android SDK version 35.0.0) [2.6s] • Platform android-35, build-tools 35.0.0 • Java binary at: C:\Program Files\Android\Android Studio\jbr\bin\java This is the JDK bundled with the latest Android Studio installation on this machine. To manually set the JDK path, use: `flutter config --jdk-dir="path/to/jdk"`. • Java version OpenJDK Runtime Environment (build 17.0.9+0--11185874) • All Android licenses accepted.[√] Visual Studio - develop Windows apps (Visual Studio Community 2022 17.13.6) [403ms] • Visual Studio Community 2022 version 17.13.35931.197 • Windows 10 SDK version 10.0.22000.0[√] Android Studio (version 2023.2) [25ms] • 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.9+0--11185874)[√] VS Code (version 1.99.2) [23ms] • Flutter extension version 3.108.0[√] Network resources [458ms] • All expected network resources are available.• No issues found!```</details>
The text was updated successfully, but these errors were encountered:
I noticed that when the long hang/timeout occurs, there is no "location" symbol in the top status bar. Once the symbol finally appears, everything proceeds quickly. I wonder what it is "waiting" for?
Also, can confirm that "high" does not have the issue. But Low and Medium both do. "reduced" does NOT have the issue either.
Please check the following before submitting a new issue.
Please select affected platform(s)
Steps to reproduce
In an Android app, request GeoLocator.getCurrentPosition().
First time is fast. I use "medium".
Then, either kill the app and re-open, or, do a hot reload if debugging.
Second time, or perhaps one or two times after, the app will hang during getCurrentPosition.
Expected results
It should again work fast after killing the app and restarting.
Actual results
After opening the app, closing the app, then re-opening, (maybe cycle that 1-3 times), Geolocator will hang for 16-20 seconds before finally getting a position.
Code sample
Code sample
Screenshots or video
Screenshots or video demonstration
[Upload media here]
Version
13.0.2
Flutter Doctor output
Doctor output
The text was updated successfully, but these errors were encountered: