flutter-geolocator icon indicating copy to clipboard operation
flutter-geolocator copied to clipboard

[Bug]: requestPermission Future never resolves, when application goes to background, when "Allow to use location" popup is displayed

Open tobolski opened this issue 1 year ago • 1 comments

Please check the following before submitting a new issue.

Please select affected platform(s)

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

Steps to reproduce

  1. Enable location on device and in application.
  2. Execute: final permission = await Geolocator.requestPermission();
  3. "Allow to use location" popup should appear: image
  4. Lock the phone.
  5. Unlock the phone.

Expected results

  • Bring back "Allow to use location" when going back to application. OR
  • Complete the Future with proper state.

Actual results

  1. "Allow to use location" is gone.
  2. final permission = await Geolocator.requestPermission(); is waiting forever.
  3. Another call to this method results in exception:
Unhandled Exception: A request for location permissions is already running, please wait for it to complete before doing another request.

Code sample

Code sample
final permission = await Geolocator.requestPermission();

Screenshots or video

final permission = await Geolocator.requestPermission();

Version

12.0.0

Flutter Doctor output

Doctor output
[✓] Flutter (Channel stable, 3.19.6, on macOS 14.4.1 23E224 darwin-arm64, locale en-PL)
    • Flutter version 3.19.6 on channel stable at /Users/xxx/git/flutter
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision 54e66469a9 (5 weeks ago), 2024-04-17 13:08:03 -0700
    • Engine revision c4cd48e186
    • Dart version 3.3.4
    • DevTools version 2.31.1
[✓] Android toolchain - develop for Android devices (Android SDK version 34.0.0)
    • Android SDK at /Users/xxx/Library/Android/sdk
    • Platform android-34, build-tools 34.0.0
    • Java binary at: /Applications/Android Studio.app/Contents/jbr/Contents/Home/bin/java
    • Java version OpenJDK Runtime Environment (build 17.0.7+0-17.0.7b1000.6-10550314)
    • All Android licenses accepted.
[✓] Xcode - develop for iOS and macOS (Xcode 15.2)
    • Xcode at /Applications/Xcode.app/Contents/Developer
    • Build 15C500b
    • CocoaPods version 1.15.2
[✓] Chrome - develop for the web
[✓] Android Studio (version 2023.1)
[✓] VS Code (version 1.89.1)
[✓] Connected device (5 available)
[✓] Network resources
    • All expected network resources are available.

• No issues found!

tobolski avatar May 23 '24 14:05 tobolski

Dear @tobolski,

This is a known issue in iOS. I'll label this as an enhancement there are multiple issues regarding this situation.

Kind regards

TimHoogstrate avatar Aug 20 '24 12:08 TimHoogstrate