Force a paired BlueTooth device to reconnect

Our iOS app uses a specific Bluetooth device from a hardware partner. The user can pair the device with a PIN and then it shows as connected in the phone's Bluetooth settings. Our app reads data from this device as part of its core functionality.


After some period of inactivity, the device disconnects, and it shows as not connected. The next time the user loads our app, they're told that the device isn't connected any more and to go back to Settings and tap the device to reconnect. This is obviously an inconvenience.


Are there any strategies for making this better? Can our app 'force' the reconnection itself, with no user input? Can it prevent the disconnection somehow?


Thanks,

Paul

Post not yet marked as solved Up vote post of cosmos21 Down vote post of cosmos21
8.4k views

Replies

Sure, you should be able to. Once you've connected to the peripheral once, you can save the peripheral.identifier.UUIDString externally. Then on another run or in another context, you can use central.retrievePeripheralsWithIdentifiers() to get back a CBPeripheral and call central.connectPeripheral() on it. But I'm guessing you're already doing something like this - which part isn't working?


In general, I think it's something of a weakness of the CoreBluetooth API that you must take separate account of many different ways of connecting to devices: scanning, ID-specific connections, auto-saved/restored connections, connections to devices that are already connected to the phone or to another app... It seems to work best to fold these into one unified, idempotent wrapper that tries to kick the connection can down the road in whatever ways are currenly available.

Paul,


Is this a MFI/External Accessory bluetooth classic device or a CoreBluetooth bluetooth low energy device?


GSnyder is right if it is a low energy device. When you disconnect, call the connect method that same device in the callback. Is it appropriate for the user to be disconnected when they are not using the app? Do you support background operation?

We are facing the same issue with our app and our app communicates with an MFI device bluetooth classic. Is there a way for our app to 'force' the reconnection after the device has been disconnected?

There is a way. Using External Accessory Framework's API:


https://developer.apple.com/reference/externalaccessory/eaaccessorymanager/1613913-showbluetoothaccessorypickerwith


This lists all the MFI devices which are connected / Not Connected. Tapping on the list item does connect the device.

Does anyone solve it "We are facing the same issue with our app and our app communicates with an MFI device bluetooth classic. Is there a way for our app to 'force' the reconnection after the device has been disconnected?"

BTW, the showbluetoothaccessorypickerwith is not an option for me. I need to reconnect without any user interaction.


Thank you,
Mauro Romer
As my company is a member of the Apple MFi licensing program, I asked for Apple support and I received the answer below.


In response to your request below, there is presently no support for implementing the bluetooth reconnection process from the device side after an existing connection has been broken. This would be an API enhancement request which you can submit using the Apple Developer feedback assistant web page  https://feedbackassistant.apple.com

One option would be for the accessory to handle the reconnection process itself as this is a supported bluetooth option. However, I understand if for power conservation reasons, this is not supported accessory option.






It means, there is no way, yet, to implement it from the App side. if you need that, you need to do it on the Device side.
We can submit feedback for the Apple, using the Apple Developer feedback assistant web page - https://feedbackassistant.apple.com to ask them to create it

Is this still true? is there no way to force bluetooth to reconnect if you are connecting to a MFi certified external accessory?