How do you read the state of the bluetooth switch in app settings?

I have an iOS app that uses bluetooth. I see a bluetooth switch in the app settings screen iOS populates automatically. How do I read the state of that switch?

Thanks

Welcome back to the Kodeco forum! :smiley:

To read the state of the Bluetooth in your app, you can utilise the CoreBluetooth framework. It’s impossible to read the state of the system’s Bluetooth switch directly, but you can infer it from CoreBluetooth’s CBManagerState.

Read the Kodeco blog article Core Bluetooth Tutorial for iOS: Heart Rate Monitor. Specifically, the section Preparing for Core Bluetooth where it covers centralManagerDidUpdateState. That method will be called whenever the Bluetooth state changes, and you can update your app’s behaviour based on the state.

1 Like

This topic was automatically closed after 166 days. New replies are no longer allowed.