What causes this iOS permission prompt for "use Bluetooth for new connections"?
Asked Answered
C

3

6

Since iOS13, our app which uses BLE beacons for location, now gets two Bluetooth related permissions prompts.

The first one is understandable and expected:

Prompt to use Bluetooth

The second prompt is not expected, and we don't know why it's happening.

Prompt to "use Bluetooth for new connections"

FYI the app is currently compiled with the previous iOS SDK/XCode.

Communize answered 29/10, 2019 at 1:49 Comment(0)
C
12

I think that this second prompt is a new iOS13 variation on "please enable Bluetooth" and that it appears because the user has set Bluetooth to "off" in the control centre, but not turned Bluetooth fully off in Settings.

The description of "use Bluetooth for new connections" seems to correspond to the "partially enabled" state (white button in control centre).

This second prompt can be stopped using the CBCentralManagerOptionShowPowerAlertKey: @(NO) option to the CBCentralManager init call.

Communize answered 29/10, 2019 at 2:59 Comment(5)
Is there a way to set a value of CBCentralManagerOptionShowPowerAlertKey in the Info.plist file?Fascia
It’s an API parameter not an info.plist entry?Calculated
oh, alright then. Just wanted to double-check. ThanksFascia
Then if the Bluetooth is partially enabled then the prompt will always appear?Goring
No, the prompt is still controlled by the power alert option (as far as I remember). Whether its partially or fully enabled just controls which kind of prompt appears.Calculated
U
2

By default, when Bluetooth is disabled every time you create a CBCentralManager this pop-up will appear.

By disabled I mean the bluetooth radio turned off. you can do this via the control center, or in your phone's settings. this is different from denying an app bluetooth permissions.

If you add a CBCentralManagerOptionShowPowerAlertKey to the options when creating your CBCentralManager this pop-up will not appear.

Swift:

let manager = CBCentralManager(delegate: nil,
                               queue: nil,
                               options: ["CBCentralManagerOptionShowPowerAlertKey": 0])

Objective-C:

[[CBCentralManager alloc] initWithDelegate:self
                                     queue:nil
                                   options:@{CBCentralManagerOptionShowPowerAlertKey: @0}];
Unexceptional answered 27/5, 2022 at 18:37 Comment(3)
Which kind of "disabled" do you mean? In the control centre, or in settings?Calculated
by disabled I mean the bluetooth radio turned off. you can do this via the control center, or in your phone's settings. this is different from denying an app bluetooth permissions.Unexceptional
They are not the same thing. Turning it off in settings does fully turn the bluetooth radio off. Turning it off in control centre leaves the radio on, and still allows some connections to work like Apple Watch or headphones. It just prevents any new connections.Calculated
S
0

Swift 5 / To disable "APP_NAME would like to use Bluetooth for new connections" alert use options when instantiating CBCentralManager:

var centralManager = CBCentralManager(delegate: YOUR_DELEGATE?, queue: YOUR_QUEUE?, options: [CBCentralManagerOptionShowPowerAlertKey: 0])
Springwood answered 11/5, 2022 at 17:12 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.