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

hasPermission and requestPermission returns different values #738

Open
KirillArtemenko opened this issue Jun 16, 2022 · 7 comments
Open
Labels

Comments

@KirillArtemenko
Copy link

KirillArtemenko commented Jun 16, 2022

On iOS after deny.

final hasPermission = await location.hasPermission();
// hasPermission == PermissionStatus.denied

final requestPermission = await location.requestPermission();
// requestPermission == PermissionStatus.deniedForever

hasPermission != requestPermission

Expected behavior
Method hasPermission must return PermissionStatus.deniedForever.
The order and numbers of method calls does not affect the result.

Steps To Reproduce

  1. Request permissions
  2. Deny
  3. Run this methods
  4. See different PermissionStatus

Tested on:

  • iOS, Version 15.5 real device
@Lyokone
Copy link
Owner

Lyokone commented Jun 17, 2022

Hey,
Thanks for the report. Which version of Location are you using?

@KirillArtemenko
Copy link
Author

KirillArtemenko commented Jun 17, 2022

I found it on location version 4.4.0 and after updating on 5.0.0-dev.7 same result.
I assume that on earlier versions too.

@mortenolsson
Copy link

I'm seeing the same on 4.4.0, iOS, physical device - would be great to have this fixed so I can display the proper UI to my users - I don't want to request permission until the users asks me to which makes me need an additional user action to discover that the permission is deniedForever.

@Lyokone
Copy link
Owner

Lyokone commented Jun 24, 2022

After investigation, on Android you need to make a first request for permission in order to determine the status.
I might change denied to underterminedOrDenied.

On iOS can't definitely be fixed 👍 I'll have a look now

@Lyokone
Copy link
Owner

Lyokone commented Jun 24, 2022

I've published a new version of location 5, let me know if it's fixed for you :)
https://pub.dev/packages/location/versions/5.0.0-dev.8

@ash-hashtag
Copy link

I'm getting the same result, but hasPermission always returns denied, and requestPermission returns deniedForever, even though I gave permission, and I've tried this 5.0.0-dev.8 but the app opens for a sec and just crashes. so any workaround with the stable version to get it working right?

@AliHoseinpoor
Copy link

I still have this problem

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

No branches or pull requests

5 participants