Skip to content

[Bug]: Infinity getting current location #1701

@stoyankirov

Description

@stoyankirov

Please check the following before submitting a new issue.

Please select affected platform(s)

  • Android
  • iOS
  • Linux
  • macOS
  • Web
  • Windows

Steps to reproduce

  1. I use Android emulator with Android 15 device
  2. Geolocator package version is ^12.0.0
  3. Flutter version is 3.19.6
  4. I open the app and choose "Only this time"/"While using the app"
  5. Bug reproduces rarely and currently it is noticed only on newer Android versions(for example Android 15)

Expected results

I expect location to be determined without any problems.

Actual results

Application loads infinitely since the location can not be determined.
Location pin icon in phone header stays forever.

What could cause this problem and how can it be solved? Is someone else facing it and are there any exact steps to reproduce? Is the problem reproducing in newer Geolocator versions?

Code sample

Code sample
        Position position = await Geolocator.getCurrentPosition(
            desiredAccuracy: LocationAccuracy.best);

</details>


### Version

^12.0.0

### Flutter Doctor output

<details><summary>Doctor output</summary>

```console
[!] Flutter (Channel [user-branch], 3.19.6, on Microsoft Windows [Version 10.0.26100.3775], locale bg-BG)
    ! Flutter version 3.19.6 on channel [user-branch] at C:\flutter
      Currently on an unknown channel. Run `flutter channel` to switch to an official channel.
      If that doesn't fix the issue, reinstall Flutter by following instructions at https://flutter.dev/docs/get-started/install.
    ! Upstream repository unknown source is not a standard remote.
      Set environment variable "FLUTTER_GIT_URL" to unknown source to dismiss this error.
    • Framework revision 54e66469a9 (1 year, 1 month ago), 2024-04-17 13:08:03 -0700
    • Engine revision c4cd48e186
    • Dart version 3.3.4
    • DevTools version 2.31.1
    • If those were intentional, you can disregard the above warnings; however it is recommended to use "git" directly to perform update checks and upgrades.

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

[√] Android toolchain - develop for Android devices (Android SDK version 35.0.0-rc3)
    • Android SDK at C:\Android
    • Platform android-35, build-tools 35.0.0-rc3
    • Java binary at: C:\Program Files\Android\Android Studio1\jbr\bin\java
    • Java version OpenJDK Runtime Environment (build 21.0.6+-13355223-b631.42)
    • All Android licenses accepted.

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

[!] Visual Studio - develop Windows apps (Visual Studio Community 2022 17.11.5)
    • Visual Studio at C:\Program Files\Microsoft Visual Studio\2022\Community
    • Visual Studio Community 2022 version 17.11.35327.3
    X Visual Studio is missing necessary components. Please re-run the Visual Studio installer for the "Desktop development with C++" workload, and include these
      components:
        MSVC v142 - VS 2019 C++ x64/x86 build tools
         - If there are multiple build tool versions available, install the latest
        C++ CMake tools for Windows
        Windows 10 SDK

[√] Android Studio (version 2024.3)
    • Android Studio at C:\Program Files\Android\Android Studio1
    • 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 21.0.6+-13355223-b631.42)

[√] VS Code (version 1.93.1)
    • VS Code at C:\Users\Stoyan Kirov\AppData\Local\Programs\Microsoft VS Code
    • Flutter extension version 3.110.0

[√] Connected device (4 available)
    • sdk gphone64 x86 64 (mobile) • emulator-5554 • android-x64    • Android 15 (API 35) (emulator)
    • Windows (desktop)            • windows       • windows-x64    • Microsoft Windows [Version 10.0.26100.3775]
    • Chrome (web)                 • chrome        • web-javascript • Google Chrome 135.0.7049.115
    • Edge (web)                   • edge          • web-javascript • Microsoft Edge 136.0.3240.50

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

</details>

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions