L.William
L.William

Reputation: 422

Turning on Bluetooth programmatically Swift

I am trying to turn on Bluetooth automatically using my app. The usual way would be for the user to go to settings and turn on. But I need to to be turned on from the app. I have gone through lots of documentation and they are referring to private APIs but all are very old. I do not mind that it's not going to be approved at App Store.

Is there any way to turning on Bluetooth programmatically?

Upvotes: 1

Views: 4015

Answers (2)

L.William
L.William

Reputation: 422

It can be done, however it's by private framework which can be found.

An example would be using BeeTee. It enables bluetooth to be turned on and the usage is given there by

class Demo: BeeTeeDelegate {
    let beeTee = BeeTee()
    
    init() {
        beeTee.delegate = self
        beeTee.enableBluetooth()
    }
}

Upvotes: 2

Hitesh Surani
Hitesh Surani

Reputation: 13537

Is there any way or hack to turning on Bluetooth programmatically?

There is no provision to turning on Bluetooth programmatically. We can only notify user If the user has turned off Bluetooth all you can do is display an alert or message asking them to turn it on.

Refer CBCentralManager for monitoring Bluetooth state.

Upvotes: 5

Related Questions