Baseflow / Baseflow/flutter-geolocator

[Bug]: Selecting one-time permission results in denied

Open
#1,566 1 comment 0 reactions 0 assignees View on GitHub
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)

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

### Steps to reproduce

Just call to Geolocator.requestPermission()

### Expected results

Expected allowed state. It seems that "one-time" option has to be added to LocationPermission enum

### Actual results

LocationPermission.denied

### Code sample

Code sample

```dart
var permission = await Geolocator.checkPermission();
if (permission == LocationPermission.deniedForever) {
// denied
}

if (permission == LocationPermission.denied) {
permission = await Geolocator.requestPermission();
if (permission != LocationPermission.whileInUse && permission != LocationPermission.always) {
// got here if one-time was selected
}
}

// ok, granted
```

### Screenshots or video

Screenshots or video demonstration

[Upload media here]

### Version

13.0.1

### Flutter Doctor output

Doctor output

```console
Doctor summary (to see all details, run flutter doctor -v):
[√] Flutter (Channel stable, 3.22.3, on Microsoft Windows [Version 10.0.22000.2538], locale ru-RU)
[√] Windows Version (Installed version of Windows is version 10 or higher)
[√] Android toolchain - develop for Android devices (Android SDK version 34.0.0)
[√] Chrome - develop for the web
[!] Visual Studio - develop Windows apps (Visual Studio Build Tools 2019 16.11.26)
X The current Visual Studio installation is incomplete.
Please use Visual Studio Installer to complete the installation or reinstall Visual Studio.
[√] Android Studio (version 2023.3)
[√] VS Code (version 1.92.2)
[√] Connected device (4 available)
[√] Network resources

! Doctor found issues in 1 category.
```

Contributor guide

Open the contributing guide

Research direction

Start with Geolocator.requestPermission() and the LocationPermission enum, then trace how Android's one-time permission result is mapped to the returned state. Confirm the expected behavior for a one-time selection and add coverage for that permission flow; the issue is resolved when it no longer returns denied incorrectly.

Written by the indexing model from the issue text.

Assessment

Tech stack
dart, flutter
Domain
mobile
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.