bluetooth disconnection handling

bluetooth disconnection handling

apeintnerapeintner Member Posts: 1
i have following problem: when the device is connected normally and the device is shut down, the 

func session(_ session: WearableDeviceSession, didCloseWithError error: Error?) method is called correctly.

But if the device's bluetooth connection itself is killed in between, the session stays active and the method is not called.

Is this intended to be or a bug? How can someone handle this?

Best regards,



  • edited 09/09/2019 - 18:41
    daniel@bose[email protected] Member Posts: 41
    Thanks for your question.  Look to the WearableDeviceSession section of our docs for ways to handle dropped connections. 
    Checking the WearableDeviceSessionState will allow you determine the current state the session is open, closed or opening.


    Represents a connection with a wearable device. A WearableDeviceSession must be retained for as long as you are interested in the connection. Once a WearableDeviceSession is deallocated, the connection is automatically closed and disposed.

    In the event that a session has closed, you will be notified via the <a rel="nofollow" href="">WearableDeviceSessionDelegate.session(_:didCloseWithError:)</a> delegate function. To re-establish communication with the remote device, you can do one of two things:

    1. You can call <a rel="nofollow" href=""></a> to open the connection again. Note that if the session was closed due to the remote device being powered down or moved out of range, it must be powered back on or moved back into range in order for this to succeed.
    2. You can perform a device search (via <a rel="nofollow" href="">BoseWearable.startDeviceSearch(mode:completionHandler:)</a>or <a rel="nofollow" href="">DeviceSearchTask</a>). Note that you must first release the closed WearableDeviceSession by setting any retained references to nil.
    If the device is shutdown - for example turning the Frames upside down, the delegate method get's called as expected:
    with the error:
    - some : Error Domain=CBErrorDomain Code=7 "The specified device has disconnected from us." UserInfo={NSLocalizedDescription=The specified device has disconnected from us.}

    This callback specifically is triggered by the loss of the BLE connection which handles the sensor data, and not the Clasich Bluetooth which manages audio connections.   Thus if you disconnect the Classic Bluetooth, that delegate will not be called. 
    I'll make a note for our developers the nuance to consider future releases. 

    @[email protected]

Sign In or Register to comment.