Establishing BLE & Persistent Bluetooth Classic Connection for Headphones in iOS App Without Requiring Users to Visit Settings

111 Views Asked by At

I've been working on an iOS headphone settings app and I'm running into a bit of a snag. I'm trying to create a BLE connection and a persistent Bluetooth classic connection for the headphones in the app, without prompting users to visit the iOS settings app (a bit like the Bose app).

I want to ensure that the app can establish a BLE connection during onboarding and maintain a persistent Bluetooth classic connection without requiring users to visit the iOS settings app to make their initial connection.

I'd greatly appreciate any insights or suggestions on how to tackle this (I can influence the development of the headphone firmware if needs be). If anyone has dealt with a similar situation or has any advice or guidance, I'm all ears!

Here's what i've tried so far:


The problem I'm facing is that, although I've managed to create a BLE connection and a Bluetooth classic connection to headphones in "pairing" state (using CBConnectPeripheralOptionEnableTransportBridgingKey), the classic connection seems to disconnect when I close the app (and connection itself is relatively inconsistent). Currently, I achieve this by looping through the characteristics of the headphones and writing some test data to those with "notify" CBCharacteristicProperties.

let value = 1234
let data = withUnsafeBytes(of: value) { Data($0) }
            
if characteristic.properties.contains(.notify) {
   peripheral.setNotifyValue(true, for: characteristic)
   peripheral.writeValue(data, for: characteristic, type: .withResponse)
}

Once this had run, I was expecting to look in the iOS Settings app and see a connected iOS device (with the "i" to show it was a classic connection). However, what I ended up with was what looked like a disconnected classic connection.


Thanks in advance for any help!

0

There are 0 best solutions below