Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug]: await Permission.location.request() returns PermissionStatus.denied when we answer approximate location. It only returns granted if we answer precise location #1384

Open
3 of 5 tasks
ember11498 opened this issue Sep 21, 2024 · 0 comments

Comments

@ember11498
Copy link

ember11498 commented Sep 21, 2024

Please check the following before submitting a new issue.

Please select affected platform(s)

  • Android
  • iOS
  • Windows

Steps to reproduce

Very simple case there is no need.

Expected results

I expected to get true when user gives us approximate location.

Actual results

i get PermissionStatus.denied when user answers approximate location instead of precise location.

Code sample

  static Future<bool> requestLocation(BuildContext context) async {
    try {
      if (await Permission.location.isPermanentlyDenied) {
        if (context.mounted) {
          showDialogLocation(context);
        }
        return false;
      } else {
        final status = await Permission.location.request();
        return status.isGranted;
      }
    } catch (e) {
      print('Error requesting location permission: $e');
      return false;
    }
  }

Screenshots or video

No need

Version

11.0.1

Flutter Doctor output

[√] Flutter (Channel stable, 3.22.3, on Microsoft Windows [Version 10.0.22631.4169], locale pt-PT)
• Flutter version 3.22.3 on channel stable at C:\src\flutter
• Upstream repository https://github.com/flutter/flutter.git
• Framework revision b0850beeb2 (9 weeks ago), 2024-07-16 21:43:41 -0700
• Engine revision 235db911ba
• Dart version 3.4.4
• DevTools version 2.34.3

[√] Windows Version (Installed version of Windows is version 10 or higher)

[√] Android toolchain - develop for Android devices (Android SDK version 34.0.0)
• Android SDK at C:\Users\35191\AppData\Local\Android\sdk
• Platform android-34, build-tools 34.0.0
• Java binary at: C:\Program Files\Android\Android Studio\jbr\bin\java
• Java version OpenJDK Runtime Environment (build 17.0.10+0--11572160)
• All Android licenses accepted.

[√] Chrome - develop for the web
• Chrome at C:\Program Files\Google\Chrome\Application\chrome.exe

[√] Visual Studio - develop Windows apps (Visual Studio Community 2022 17.5.3)
• Visual Studio at C:\Program Files\Microsoft Visual Studio\2022\Community
• Visual Studio Community 2022 version 17.5.33516.290
• Windows 10 SDK version 10.0.22000.0

[√] Android Studio (version 2023.3)
• Android Studio at C:\Program Files\Android\Android Studio
• Flutter plugin can be installed from:
https://plugins.jetbrains.com/plugin/9212-flutter
• Dart plugin can be installed from:
https://plugins.jetbrains.com/plugin/6351-dart
• Java version OpenJDK Runtime Environment (build 17.0.10+0--11572160)

[√] VS Code (version 1.93.1)
• VS Code at C:\Users\35191\AppData\Local\Programs\Microsoft VS Code
• Flutter extension version 3.97.20240902

[√] Connected device (4 available)
• sdk gphone64 x86 64 (mobile) • emulator-5554 • android-x64 • Android 13 (API 33) (emulator)
• Windows (desktop) • windows • windows-x64 • Microsoft Windows [Version 10.0.22631.4169]
• Chrome (web) • chrome • web-javascript • Google Chrome 128.0.6613.138
• Edge (web) • edge • web-javascript • Microsoft Edge 129.0.2792.52

[√] Network resources
• All expected network resources are available.

• No issues found!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant