Client (Nrf Connect ) has bonding keys while Peripheral don't

In case of peripheral losing keys, but client(Android nrf connect app) still  has them. (  shows it is  in  'Disconnected + 'Bonded' ) 

On the next connection attempt, there is a 'connection' and straight away a 'disconnection' event on the peripheral side. Nrf connect on Android  then clears the keys ( shows: Disconnected  , Not Bonded)

Is it AndroidOS trying to do something , or accessing something with the keys?

Or is it some action done by NrfConnect App itself? That I can disable? 

Anyway, would like to know why is it happening ? Is there a way to prevent the disconnection and have them figure things out?

  • Hi, 

    It should delete the bond information on the nRF Connect app and initiate a new bond with the peripheral device

    Regards,
    Amanda H.

  • Sorry , could you elaborate a little more?

    Who is  - It? 

    What in the process is causing a disconnection? Is there an event or something that forces the App to disconnect? Or is it AndroidOS? 

    Also, If a App is Connected and has keys for Bonding , can it wait for a request from the peripheral to bond  ? Can such app be created?

  • Hi,

    Which SDK are you using, nRF5 or NCS?

    In case of peripheral losing keys, but client(Android nrf connect app) still  has them. (  shows it is  in  'Disconnected + 'Bonded' ) 

    On the next connection attempt, there is a 'connection' and straight away a 'disconnection' event on the peripheral side. Nrf connect on Android  then clears the keys ( shows: Disconnected  , Not Bonded)

    If you are using nRF5 SDK, This is the default behavior (as implemented by Nordic SDK), and we have done it this way due to a security aspect, you may not want an attacker to disguise itself as a bonded peer to delete/overwrite bonding information. 

    We usually suggest users delete bond information on the phone side to start a new bond process. 

    DS4 said:
    What in the process is causing a disconnection? Is there an event or something that forces the App to disconnect? Or is it AndroidOS? 

    The default behavior of nRF5SDK is not to allow bonding in this situation, but you can allow it by handling it like this in your peer manager event handler:

            case PM_EVT_CONN_SEC_CONFIG_REQ: 
                pm_conn_sec_config_t config = {.allow_repairing = true};
                pm_conn_sec_config_reply(p_evt->conn_handle, &config);
                break;

    If you are using NCS, you can refer to this post

    -Amanda H.

  • Thanks, regarding

    "We usually suggest users delete bond information on the phone side to start a new bond process."

    Can bonding keys be deleted while devices are connected, and pairing has not started yet?

    When I press connect on the App, it also continues to auth/pair..(if it has bonding keys)

    Can I disable it, so it waits for pairing command ? 

  • Hi,

    The behavior you're describing is typically managed by the Bluetooth stack on the phone, which automatically attempts to authenticate (and thus pair) when connecting to a device it has previously bonded with. This is standard behavior for Bluetooth devices and is part of the security measures in the Bluetooth specification.

    If the phone has bonding information stored, it will attempt to authenticate the connection using that information. If you want to prevent this, you would need to delete the bonding information on the phone before initiating the connection. This is typically done through the phone's Bluetooth settings, not programmatically through your app.

    -Amanda H.

Related