flutter-geolocator
flutter-geolocator copied to clipboard
[Bug]: requestPermission Future never resolves, when application goes to background, when "Allow to use location" popup is displayed
Please check the following before submitting a new issue.
- [X] I have searched the existing issues.
- [x] I have carefully read the documentation and verified I have added the required platform specific configuration.
Please select affected platform(s)
- [ ] Android
- [X] iOS
- [ ] Linux
- [ ] macOS
- [ ] Web
- [ ] Windows
Steps to reproduce
- Enable location on device and in application.
- Execute:
final permission = await Geolocator.requestPermission(); - "Allow to use location" popup should appear:
- Lock the phone.
- 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
- "Allow to use location" is gone.
final permission = await Geolocator.requestPermission();is waiting forever.- 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!
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