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

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

Open rawthriver opened this issue 1 year ago • 1 comments

Please check the following before submitting a new issue.

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
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
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.

rawthriver avatar Aug 28 '24 08:08 rawthriver