This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

iOS refuses peripheral disconnection

On my peripheral I filter the devices connected and refuses them when not bonded. When a device not bonded tries to connect to the peripheral, it forces the disconnection and waits some seconds. It seems to work as spected, but on iOS, there are two different behavior:

Case 1, iOS device not bonded. Bonding has never occurred: -the iPhone connects -the peripheral closes the connection -the iPhone does not try to reconnect. This is the expected behavior.

Case 2, Bonding has done. Bonding is deleted only on the peripheral, not on the iPhone. -the iPhone connects -the peripheral closes the connection -the iPhone tryes to reconnect permanently, even if the app is completely closed (Nordic nRF Connect or Lightblue)

How can I avoid the iOS reconnection, if I can't remove the bond on the phone?

  • Hi Jemajuca!

    If you remove the bonding information on the peripheral only, the bonding keys will be deleted.
    When iOS tries to reconnect, it will try to set up an encrypted connection using the previously established keys.
    If the peripheral no longes have those keys, you need to manually remove the bonding information on the iOS side as well.
    You can do that in the bluetooth settings on your iOS device.

    Let me know if you still have any questions.
    Best regards,
    Joakim.

  • Hello Joakim It is correct, I should delete the bonding on the iOS device, but I need to implement a solution for that scenario it it happens: Let's think that you have lost the phone. You delete it's bond on the peripheral, but you have no access to the phone. If any person find the phone and tries to connect, then... the problem occurs.

  • I'm not sure if I understand your problem.
    If the phone is bonded to the device and then somehow gets lost, then the problem should be irrelevant.
    If the phone at a later time is found by someone that tries to connect, they won't be able to access the device, as the bonding information is already deleted on the peripheral.
    It would simply be to delete the bonding information on the phone when it is found, and then reconnect.
    Please correct me if I'm misunderstanding you.
    Best regards.

  • Hello Joakim you are right. I know it's a rare situation, but it can happen. As described on Case 2, iOS tries to connect again and again to the peripheral. The peripheral simply closes the connection every time, and iOS reconnects everytime, so it can causes something similar to a DoS, so other can not connect. Android has a different behavior, it only tryies to reconnect one time, so no problem. We have fixed the problem restarting also the advertising. Regards.

  • Hi Jemajuca!
    I'm afraid this is related to iOS behavior, and it's not much to do about this from our side.
    You could try to post a bug-report with apple about this problem.
    The best way to solve this would be to find a way to delete the bonding information on the iPhone.

    An alternative solution to help solve the problem might be to use whitelisting.
    Best regards.

Related