Baseflow / Baseflow/flutter-geolocator
[Bug]: requestPermission Future never resolves, when application goes to background, when "Allow to use location" popup is displayed
- Dominant language
- Dart
- Stars
- 1.3k
- Forks
- 803
- Avg merge
- 8h 16m
- Merged PRs (30d)
- 1
Description
### Please check the following before submitting a new issue.
- [X] I have searched the [existing issues](https://github.com/baseflow/flutter-geolocator/issues).
- [x] I have carefully [read the documentation](https://github.com/Baseflow/flutter-geolocator/blob/main/geolocator/README.md) 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
1. Enable location on device and in application.
2. Execute: `final permission = await Geolocator.requestPermission();`
3. "Allow to use location" popup should appear:

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
```dart
final permission = await Geolocator.requestPermission();
```
### Screenshots or video
final permission = await Geolocator.requestPermission();
### Version
12.0.0
### Flutter Doctor output
Doctor output
```console
[✓] 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!
```
Contributor guide
Assessment
This issue has not been assessed yet.