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

how to make a device to advertise for longer time without connecting to ble app

hi

how to make a device to advertise for longer time without connecting to ble app.. 

Thanks in advance 

  • You set the advertising time when you configure the advertising e.g.

        /* Set advertising parameters */
        ble_gap_adv_params_t adv_params;
        memset(&adv_params, 0, sizeof(adv_params));
    
        adv_params.primary_phy = BLE_GAP_PHY_1MBPS;
        adv_params.duration = APP_ADV_DURATION;
        adv_params.properties.type = BLE_GAP_ADV_TYPE_CONNECTABLE_SCANNABLE_UNDIRECTED;
        adv_params.p_peer_addr = NULL;
        adv_params.filter_policy = BLE_GAP_ADV_FP_ANY;
        adv_params.interval = APP_ADV_INTERVAL;
    
        err_code = sd_ble_gap_adv_set_configure(&m_adv_handle, &m_adv_data, &adv_params);
        APP_ERROR_CHECK(err_code);

    APP_ADV_DURATION is the time, in milliseconds that your device will advertise for. You can change this to 0 if you wish the advertising to never timeout.

Related