8000 [Bug]: Geolocator.getCurrentPosition hangs after app restart · Issue #1687 · Baseflow/flutter-geolocator · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

[Bug]: Geolocator.getCurrentPosition hangs after app restart #1687

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
3 of 8 tasks
corepuncher opened this issue Apr 15, 2025 · 4 comments
Open
3 of 8 tasks

[Bug]: Geolocator.getCurrentPosition hangs after app restart #1687

corepuncher opened this issue Apr 15, 2025 · 4 comments
Assignees

Comments

@corepuncher
Copy link
corepuncher commented Apr 15, 2025

Please check the following before submitting a new issue.

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 = await Geolocator.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>
@TimHoogstrate
Copy link
Contributor

@corepuncher,

How did you test this, on a simulator? Or a real device?

Kind regards,

@TimHoogstrate TimHoogstrate self-assigned this Apr 16, 2025
@TimHoogstrate TimHoogstrate added the status: needs more info We need more information before we can continue work on this issue. label Apr 16, 2025
@corepuncher
Copy link
Author
corepuncher commented Apr 16, 2025

Real device. Galaxy S23+

At first I thought it was happening only when hot reloading during debugging.

However, when running the app alone on the device (debug OR release build), startup was also delayed after closing the app and immediately restarting.

@github-actions github-actions bot removed the status: needs more info We need more information before we can continue work on this issue. label Apr 16, 2025
@YarosMallorca
Copy link

Can confirm this is an issue. This doesn't happen if I set LocationAccuracy.high

@corepuncher
Copy link
Author
corepuncher commented May 6, 2025

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.

"hang" times are typically 10-20 seconds.

5389

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants
0