flutter-permission-handler
flutter-permission-handler copied to clipboard
locationAlways permission isGranted returns true when location permission is set to "while using"
🐛 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
- Request location in your app and select the "while using" option
- Run the following statement after this
final isGranted = await Permission.locationAlways.isGranted
- 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
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.
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 istrue
??
iOS: 16.4 flutter version: 2.10.3
Experiencing the same problem on the latest version of permission_handler
I am also seeing this behavior on the simulator for iOS 16.2 using permission_handler 11.0.1
I have this on ios 17.2.1 permission_handler 11.1.0
I still have this on ios 17.1.2 & 16.6.2 permission_handler 11.1.0
@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.
-
Permission.location.requset()
was called first andPermission.locationAlways.requset()
was called. 1-1. Select Allow Once return denied 1-2. Select Allow While Using App return granted -
Permission.locationWhenInUse.requset()
was called first andPermission.locationAlways.requset()
was called. 2-1. Select Allow Once return denied 2-2. Select Allow While Using App show locationAlways dialog -
Permission.locationAlways.requset()
was called first 2-1. Select Allow Once return granted 2-2. Select Allow While Using App return granted
Thank you.