Two pairing requests on Android

I'm using SDK12 and SDK15 on nRF52832 and nRF52840 (peripheral and central), although this would appear to be an issue with other devices too.

  • If I connect with NRF Connect and click 'Bond' I only get one pair request - perfect.
  • If I connect with NRF Connect and request bonding with pm_conn_secure(..., false) from the nRF52 I get two pairing requests in quick succession
  • If I reflash the nRF52 so it loses pairing info, then connect with NRF Connect, I also get two pairing requests in quick succession (probably because of the pm_conn_secure in  PM_EVT_CONN_SEC_FAILED)

It seems that the process is something like:

  • Call pm_conn_secure
  • Get PM_EVT_CONN_SEC_PARAMS_REQ, which we ignore (because this only seems needed for NFC?)
  • Pairing request pops up on Android
  • When you click pair on the phone...
  • PM_EVT_CONN_SEC_START (ignored)
  • PM_EVT_CONN_SEC_PARAMS_REQ (ignored)
  • PM_EVT_CONN_SEC_CONFIG_REQ (pm_conn_sec_config_reply( allow_repairing = true )
  • BLE_GAP_EVT_SEC_PARAMS_REQUEST (handled by peer manager internally)
  • SECOND Pairing request pops up on Android
  • When you click pair on the phone...
  • BLE_GAP_EVT_CONN_SEC_UPDATE (handled by peer manager internally)
  • PM_EVT_CONN_SEC_SUCCEEDED 
  • PM_EVT_PEER_DATA_UPDATE_SUCCEEDED
  • BLE_GAP_EVT_AUTH_STATUS
  • PM_EVT_PEER_DATA_UPDATE_SUCCEEDED

It seems some other people have had similar problems (including with your example code) but there doesn't appear to be a solution in either case?

It doesn't happen on iPhone, but the issue here is that in order to support AMS/ANCS (I reproduced this without enabling support for them) we have to initiate pairing when connected to an iPhone, and we don't know whether we're connected to an iPhone or Android device when we first connect, so have to default to calling pm_conn_secure.

Is there any known workaround/solution for this? Right now it seems like it provides a very poor user experience.

Parents Reply Children
No Data
Related