Beware that this post is related to an SDK in maintenance mode
More Info: Consider nRF Connect SDK for new designs

Unable to Connect on Android After Connecting Via Bluetooth Device List

We have been having a persistent issue with customers that have Android phones.  Our product uses the nRF SDK and we have a iPhone and Android Web app that is based on Cordova and Ionic.

We connect to our product within the our app without issue.  The problem is sometimes customers go to their Bluetooth Device list on their Android phone and try and connect to our product that way as it appears in the list of devices.  Once this happens then our app can no longer connect to the device on that phone without reseting the networking settings of that phone.  This doesn't happen with iPhones as our product never shows up in the Bluetooth Devices List.

Is it normal for the BLE devices to show in the Bluetooth Devices List on Android devices?  Is there a way to stop it showing up in that list or something else I can do so that it won't allow customers to try and connect that way?

Thanks,

Parents Reply Children
  • We had exactly the same issue with some of our own users.  Once the Android OS had tried pairing it would then never be able to make a good connection to that device again - even if you unpaired it.  I seem to recall there was some method of clearing network settings off the phone, but it wasn't was and there was nothing we could do in firmware to recover once it had gone wrong.

    We worked around this by rejecting a pairing request should the phone ever try and pair.  This stopped us getting into the errant state in the first place.  

    This was achieved by adding the following case to ble_evt_handler() so that the BLE device tells the phone that it does not accept pairing.

            case BLE_GAP_EVT_SEC_PARAMS_REQUEST:
                // Pairing not supported
                NRF_LOG_INFO("reject the pairing request"); 
                sd_ble_gap_sec_params_reply(m_conn_handle,
                                                       BLE_GAP_SEC_STATUS_PAIRING_NOT_SUPP,
                                                       NULL,
                                                       NULL);
                break;
    

Related