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

autoreconnect doesn't work on Android

Hi. I'm using nRF51822 with softdevice 8. I started working with the uart example. and it works fine. However, I can't get the BLE to reconnect automatically once the device is near. Basically, the callback defined in Android is never called. I'm sure I got the Android side correct, as different firmware does work with it.

This is my init code for advertisement. am I doing something wrong ?

static void advertising_init(void)
{
    uint32_t      err_code;
    ble_advdata_t advdata;
    ble_advdata_t scanrsp;

    // Build advertising data struct to pass into @ref ble_advertising_init.
    memset(&advdata, 0, sizeof(advdata));
    advdata.name_type          = BLE_ADVDATA_FULL_NAME;
    advdata.include_appearance = false;
    advdata.flags              = BLE_GAP_ADV_FLAGS_LE_ONLY_GENERAL_DISC_MODE;

    memset(&scanrsp, 0, sizeof(scanrsp));
    scanrsp.uuids_complete.uuid_cnt = sizeof(m_adv_uuids) / sizeof(m_adv_uuids[0]);
    scanrsp.uuids_complete.p_uuids  = m_adv_uuids;

    ble_adv_modes_config_t options = {0};

    options.ble_adv_slow_enabled = BLE_ADV_SLOW_ENABLED;
    options.ble_adv_slow_interval = APP_ADV_INTERVAL;
    err_code = ble_advertising_init(&advdata, &scanrsp, &options, on_adv_evt, NULL);
    APP_ERROR_CHECK(err_code);
}
Related