How to get bluetooth status in independent watch (standalone app)?

Is there any way to known about Bluetooth on/off in my watch application because to update that status to the user.


I only want to know bluetooth on or off nothing else(not want to connect with any device).

If you test state, you should know if on or off.


ClassCBManager


SDKs
  • iOS 10.0+
  • macOS 10.13+
  • tvOS 10.0+
  • watchOS 3.0+
  • Mac Catalyst 13.0+
Framework

Core Bluetooth

Declaration

class CBManager : NSObject


Topics

Accessing the Manager’s Properties


     var state: CBManagerState

The current state of the manager.


Manager States


     case poweredOff

A state that indicates Bluetooth is currently powered off.


     case poweredOn

A state that indicates Bluetooth is currently powered on and available to use.


     case resetting

A state that indicates the connection with the system service was momentarily lost.


     case unauthorized

A state that indicates the application isn’t authorized to use the Bluetooth low energy role.


     case unknown

The manager’s state is unknown.


     case unsupported

A state that indicates this device doesn’t support the Bluetooth low energy central or client role.


Thank you.


I go through your solution, so I get state value unknown (or some time unsupported).

I check it in the simulator maybe for that it give this result.


To check this real device required or simulator can work??

There are functions involving system status that can only be checked on device.

A simple way is to print the result into a label on the watch, to make sure it runs independantly.

How to get bluetooth status in independent watch (standalone app)?
 
 
Q