Bluetooth and shared iCloud accounts

I know this will sound like a weird use case, but it is potentially relevant to a product I am working on.

If I were to link two or more iPhones to the same iCloud account (I know this is uncommon and generally a bad idea, but it is possible so I have to consider it). Next I pair a BLE device to one of the phones using my app which has the background bluetooth permission with the app acting as the central so it can automatically restore a connection when the BLE device comes back into range.

I then install the same app on the other iPhone(s) linked to this account and separate them physically so they are out of BLE range of each other.

The BLE device is taken out of range of the first phone and into range of one of the others.

First question is will the BLE device automatically connect to the other iPhone?

If yes, will the app have any way of determining that it's running on a different iPhone with the same device connected?

If yes, can the app prevent connection to the other phones in some way?

Answered by Engineer in 816781022

There are two separate mechanisms here, and they are independent.

I presume you are asking this because you are aware of Bluetooth iCloud pairing, where the system shares Bluetooth connection and pairing information for Bluetooth devices with other Apple devices on the same iCloud account. This is for ease of pairing the same device between multiple devices.

And depending on the device, the connection could be automatic.

The system keeping a BLE connection active when your app is not, on the other hand, is a local function, where the Bluetooth stack will keep a copy of your CBManager objects on your behalf, and when n activity requiring a response from your app (for example a connection), the system launches your app and hands over the copy of objects they were keeping to your app.

In the scenario you were hoping (or were afraid perhaps?) on multiple devices, while the pairing information is shared and the system may automatically pair and connect to the device, the local Bluetooth stack on the second device would not be aware of what was going on with your app and the stack on the first device.

If this was a scenario you wanted to implement and make it work, you would first need both phones to have run the app once (and not swipe kill it), and have both apps scan for the peripheral - whichever gets to connect first. To share state between two phones, you could use iCloud to store the state, and whichever app reconnects, could read the state and then continue from where the other phone left off.


Argun Tekant /  DTS Engineer / Core Technologies

Accepted Answer

There are two separate mechanisms here, and they are independent.

I presume you are asking this because you are aware of Bluetooth iCloud pairing, where the system shares Bluetooth connection and pairing information for Bluetooth devices with other Apple devices on the same iCloud account. This is for ease of pairing the same device between multiple devices.

And depending on the device, the connection could be automatic.

The system keeping a BLE connection active when your app is not, on the other hand, is a local function, where the Bluetooth stack will keep a copy of your CBManager objects on your behalf, and when n activity requiring a response from your app (for example a connection), the system launches your app and hands over the copy of objects they were keeping to your app.

In the scenario you were hoping (or were afraid perhaps?) on multiple devices, while the pairing information is shared and the system may automatically pair and connect to the device, the local Bluetooth stack on the second device would not be aware of what was going on with your app and the stack on the first device.

If this was a scenario you wanted to implement and make it work, you would first need both phones to have run the app once (and not swipe kill it), and have both apps scan for the peripheral - whichever gets to connect first. To share state between two phones, you could use iCloud to store the state, and whichever app reconnects, could read the state and then continue from where the other phone left off.


Argun Tekant /  DTS Engineer / Core Technologies

Thanks. It sounds like the scenario I was afraid of is not actually possible as long as the device has not been manually paired with each iPhone/iPad. That is good news.

Bluetooth and shared iCloud accounts
 
 
Q