-
-
Notifications
You must be signed in to change notification settings - Fork 869
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
Getting PermanentlyDenied when I request bluetooth permission #830
Comments
Any update on this one? I'm experiencing the same issue |
Hi @Yahllil, Did you have a look at my previous comment? |
@mvanbeusekom trying that... I think this is correct for BLE; I'll post an update when I get back to the iPhone:
|
It reliably asks for the "Use Bluetooth Connection," but it just quits with Permission.bluetoothConnect.request returning PermanentlyDenied... My Code
|
At one point it said "you can ask for multiple permissions at the same time" -- how do you do that when it's Permission.XXX.request -- Permission.(Bluetooth | Connection | Location).Request? |
Oh, and can I do this as part of initstate? It seems odd to put it someplace else.. |
Any update on this ? Me also Failed to request Permission in IOS . |
@libindstme are you also requesting Bluetooth permissions? |
@thormj, thank you for supplying the example code and detailed reproduction steps, I will be looking into the behavior and get back to you a.s.a.p. Regarding your other questions:
Requesting multiple permissions can be done using an array of permissions (p.s. note the the Map<Permission, PermissionStatus> statuses = await [
Permission.bluetooth,
Permission.location,
].request();
Yes the |
A-ha! I'm getting PermanentlyDenied on things that "aren't in iOS"-- If it's permanently denied, it makes sense to open the app settings for "yes, I need Bluetooth," but if there isn't a permission for that (I'm assuming it will just work)... presenting the user with an app settings dialogue doesn't make much sense. I'm kinda assuming I do need those permissions... maybe I don't? -- on my Android, it appears I don't but I wrapped them in a Platform.isAndroid just to fix it for certain. Should I make this post into a bug? |
have the same problem, permissions (bluetoothScan, bluetoothConnect) always PermanentlyDenied but bluetooth scan working. |
What could be the issue here is the line: CBManagerAuthorization blePermission = [_centralManager authorization];
return [BluetoothPermissionStrategy parsePermission:blePermission]; I don't think this is the way how you listen for bluetooth permission result. Basically, when you construct CBCentralManager that will invoke the permission prompt. BUT, the user didn't yet click anything, and calling The proper way would be to use a delegate and listen for a change: @objc func centralManagerDidUpdateState(_ central: CBCentralManager) {
// This has to be called, as user cannot dismiss prompt. He will either clic:
// - allow -> _central.state == .poweredOn or .poweredOff
// - don't allow -> _central.state == .unathorized
} But that requires a bit of refactoring inside strategy as it should work async. |
i also experience this problem with ios and bluetooth permissions
|
Same issue here, on iOS 16.
Bluetooth is enabled in the app settings. |
Same issue here |
same issue here. permanently denied on iOS 13
any clue? |
Hi everyone! I recently looked into a similar issue and believe @itsJoKr might be right. This would basically come down to a race condition in the Objective-C code. I will investigate and (hopefully) come back with a PR that resolves this issue. |
Hi everyone! We just landed some changes to the code relevant for this issue. As a by-product, this issue might be solved. |
Without additional information, we are unfortunately not able to resolve this issue. Therefore, we reluctantly closed this issue for now. If you run into this issue later, feel free to file a new issue with a reference to this issue. Add a description of detailed steps to reproduce, expected and current behaviour, logs and the output of 'flutter doctor -v'. Thanks for your contribution. |
Updating to the latest version in pubs.yml didnt solve. Podfile and info.plist permissions are OK. .lock: |
Hello everyone, ios and android are different solutions. void requestBluetoothPermission() async {
if (Platform.isAndroid) {
[Permission.bluetoothScan, Permission.bluetoothConnect]
.request()
.then((status) {
if (status[Permission.bluetoothScan] == PermissionStatus.granted &&
status[Permission.bluetoothConnect] == PermissionStatus.granted) {
bluetoothIsGranted.value = true;
} else {
bluetoothIsGranted.value = false;
}
});
}
if (Platform.isIOS) {
[Permission.bluetooth].request().then((status) {
if (status[Permission.bluetooth] == PermissionStatus.granted) {
bluetoothIsGranted.value = true;
} else {
bluetoothIsGranted.value = false;
}
});
}
} |
Hi everyone, I have been unable to reproduce this issue on a physical iPhone running iOS 16. I have used the code provided in the original post, combined with the code in this comment. For me, the code works as expected on the latest version of the plugin (11.0.0). The call to Note: the If you are experiencing this problem, please provide me with the details of your setup, including:
|
Without additional information, we are unfortunately not able to resolve this issue. Therefore, we reluctantly closed this issue for now. If you run into this issue later, feel free to file a new issue with a reference to this issue. Add a description of detailed steps to reproduce, expected and current behaviour, logs and the output of 'flutter doctor -v'. Thanks for your contribution. |
@JeroenWeener this issue is still happening. I have just experienced this. I have added a very descriptive comment here #1333 (comment) please take a look |
Update: I managed to fix the issue. I have updated my comment here #1333 (comment) |
Only seems to happen on iOS;
When I do a Permission.bluetooth.request(), I'm getting back "PermantentlyDenied" with no dialog...
I have this in my info.plist:
And I do the following in main.dart:
I've heard that Apple says you need to request permissions after the UI --- so is the request() only done once, and where should I put it in the code (I put it in the DoScan because that's what kicks everything off for me, but that fires before the UI appears)...
The text was updated successfully, but these errors were encountered: