# Using location configurator APIs

This sample app gives basic idea about using location configurator APIs.

1. Implement a command response method

void CmdResponse(ErrorCode error) {
        if (error == ErrorCode::SUCCESS) {
            std::cout << " Command executed successfully" << std::endl;
        }
        else {
            std::cout << " Command failed\n errorCode: " << static_cast<int>(error) << std::endl;
        }
    }
    Copy to clipboard

2. Get the LocationFactory instance

auto &locationFactory = LocationFactory::getInstance();
    Copy to clipboard

3. Get LocationConfigurator instance

std::promise<ServiceStatus> prom = std::promise<ServiceStatus>();
    auto locConfigurator_ = locationFactory.getLocationConfigurator([&](ServiceStatus status) {
         prom.set_value(status);
    });
    Copy to clipboard

4. Wait for the Location Config. initialization

ServiceStatus managerStatus = locConfigurator_->getServiceStatus();
     if (managerStatus != ServiceStatus::SERVICE_AVAILABLE) {
         std::cout << "Location Config. is not ready, Please wait!!!... "<< std::endl;
         managerStatus = prom.get_future().get();
     }
    Copy to clipboard

5. Exit the application, if SDK is unable to initialize location config

if (managerStatus == ServiceStatus::SERVICE_AVAILABLE) {
        std::cout<< "Location Config. is ready" << std::endl;
    } else {
        std::cout << " *** ERROR - Unable to initialize Location Config."<< std::endl;
        return -1;
    }
    Copy to clipboard

6. Enable/Disable Constraint Tunc API

// CmdResponse callback is invoked with error code indicating
    // SUCCESS/FAILURE of the operation
    locConfigurator_->configureCTunc(enable, CmdResponse, optThreshold, optPower);
    Copy to clipboard

Last Published: Mar 31, 2026

[Previous Topic
Location, SV and Jammer reports](https://docs.qualcomm.com/bundle/publicresource/80-PF458-9/topics/location_services.md) [Next Topic
Modem configuration](https://docs.qualcomm.com/bundle/publicresource/80-PF458-9/topics/modem_config.md)