flutter-permission-handler icon indicating copy to clipboard operation
flutter-permission-handler copied to clipboard

locationAlways permission isGranted returns true when location permission is set to "while using"

Open noah-depriest opened this issue 1 year ago • 9 comments

🐛 Bug Report

First off, thank you for taking the time to support this plugin. It's been a huge help for us and I know handling permissions on multiple platforms and versions is a pain.

We've been having some trouble around the locationAlways permission, and for us we're stuck on this problem on iOS: If the app's location permission is set to "while using", the result of await Permission.locationAlways.isGranted will return true.

Expected behavior

The expected behavior is that if the location permission is set to anything other than "always" (including "while using"), then await Permission.locationAlways.isGranted should return false.

Reproduction steps

  1. Request location in your app and select the "while using" option
  2. Run the following statement after this final isGranted = await Permission.locationAlways.isGranted
  3. Confirm that isGranted has a value of true

Configuration

  • iOS 15
  • iPhone Mini 12
  • Flutter 3.7.7
  • Dart 2.19.1

Version: permission_handler - 10.2.0

Platform:

  • [x] :iphone: iOS
  • [ ] :robot: Android

noah-depriest avatar Mar 22 '23 19:03 noah-depriest

Update on this: After updating iOS to version 16 I can't seem to reproduce the issue anymore. Maybe the update cleared out some weird state on the phone, or maybe something incompatible with that version? Leaving open for now in case anyone else has had problems with iOS 15.

noah-depriest avatar Mar 24 '23 01:03 noah-depriest

I have the same problem. How to fix it?

lasted version permission_handler: ^10.4.5

Reproduce step:

  • The first time, I selected my location was "while using"
  • After, I get status permission await Permission.locationAlways.isGranted but the result is true??

iOS: 16.4 flutter version: 2.10.3

MrLongg71 avatar Sep 07 '23 02:09 MrLongg71

Experiencing the same problem on the latest version of permission_handler

christianwbc avatar Sep 20 '23 08:09 christianwbc

I am also seeing this behavior on the simulator for iOS 16.2 using permission_handler 11.0.1

andy-weinstein avatar Nov 07 '23 19:11 andy-weinstein

I have this on ios 17.2.1 permission_handler 11.1.0

i-jared avatar Dec 27 '23 22:12 i-jared

I still have this on ios 17.1.2 & 16.6.2 permission_handler 11.1.0

2ChanWoo avatar Jan 10 '24 04:01 2ChanWoo

@mvanbeusekom Please check this case. 🙏

iOS 17.2 permission_handler : 11.2.0

I've been testing for the Permission.locationAlways status.

Before calling Permission.locationAlways.requset(), I called Permission.location.requset()or Permission.locationWhenInUse.requset() and the value of Permission.locationAlways status was different depending on what I did.

  1. Permission.location.requset()was called first and Permission.locationAlways.requset() was called. 1-1. Select Allow Once return denied 1-2. Select Allow While Using App return granted

  2. Permission.locationWhenInUse.requset() was called first and Permission.locationAlways.requset() was called. 2-1. Select Allow Once return denied 2-2. Select Allow While Using App show locationAlways dialog

  3. Permission.locationAlways.requset() was called first 2-1. Select Allow Once return granted 2-2. Select Allow While Using App return granted

Thank you.

JaeHeee avatar Feb 07 '24 06:02 JaeHeee