How to handle situation if user chose "Allow Only Once" ?
Hi all, I would like to request permission for "location always" in my app. I first request permission for "location while in use", then if it's granted, I'll request "location always".
However, in iOS 15, if the user chose "Allow Only Once" for "location while in use" permission, the permission status returns granted and the request for "location always" is stuck. I suspect the app could not request for "location always" when "only once" permission is granted. Now my app is stuck at the black loading screen. How could I detect if the user chose "Allow only once" option? And how could I request for "location always" permission?
The flow below works fine if the user chose "location when in use", it just didn't work if the user chose "allow only once", many thanks!
final locationWhenInUseStatus = await Permission.locationWhenInUse.request();
print("Location when in use status: $locationWhenInUseStatus");
if (locationWhenInUseStatus.isGranted) {
print("Location when in use is granted");
var locationAlwaysStatus = await Permission.locationAlways.request();
print("After requesting location always");
if (!locationAlwaysStatus.isGranted) {
print("Location always is denied");
bool res = await openAppSettings();
}
}
if (!locationWhenInUseStatus.isGranted) {
print("Location when in use is not granted");
}
Hi @nhlhelen,
Seems like you are handling it the correct way, I am not familiar with this particular behaviour and will look into it. I will get back to you afterwards.
@mvanbeusekom Thanks for the prompt reply! Hope to hear from you soon.
Hello, I got same problem here. If user select allow once when app is requesting location permission for location always permission(readme says if you want to request location always, you should request locationWhileInUse permission first), await Permission.locationalways.request() not showing any dialogs for location always permission. Then if i call await Permission.locationalways.request() again, I got ERROR_ALREADY_REQUESTING_PERMISSIONS . Is there any way to check if location permission is allow once?
@choi-seung-min I have the same issue too @mvanbeusekom Any update on this?
I have this same issue. I'm happy to help fix it if someone is not already on it.
same here
same here
I'm also having this issue.
Same issue how can we achieve this?
I'd like to keep this issue open. Just ran into the same issue
I "solved" it by making the calls non-blocking. It might not work for every scenario.
instead of status = await Permission.locationAlways.request(); --> Permission.locationAlways.request();
It's not ideal, as I'd like to store the status, but as long as we can't handle this case and the call ends up blocking forever, there is nothing else to do.
Hope this gets fixed.
any updates? Or any workarounds available?
I have fixed it already, waiting for review
https://github.com/Baseflow/flutter-permission-handler/pull/1028
@mvanbeusekom I see this issue on the latest version (11.3.1).
When user select "Allow Once" I call:
await Permission.locationAlways.request();
But nothing is happening.