0

I am trying to get location on my Gear S3 Frontier watch. After enabling the location service I'm unable to get any response.

Some Relevant Code:

location_manager_h location_manager;                                            
location_service_state_e location_service_state = LOCATIONS_SERVICE_DISABLED;

void setup_location_manager()
{
    if (location_manager_create(LOCATIONS_METHOD_GPS, &location_manager) != LOCATIONS_ERROR_NONE)
    {
        dlog_print(DLOG_DEBUG, LOG_TAG, "setup_location_manager: Failed to setup the Location Manager.");
        service_app_exit();
    }

    if(location_manager_set_service_state_changed_cb(location_manager, location_state_changed_callback, NULL) != LOCATIONS_ERROR_NONE)
    {
        dlog_print(DLOG_DEBUG, LOG_TAG, "setup_location_manager: Failed to register service_state_changed callback for the Location Manager.");
        service_app_exit();
    }

    if(location_manager_set_position_updated_cb(location_manager, location_data_updated_callback, 1, NULL) != LOCATIONS_ERROR_NONE)
    {
        dlog_print(DLOG_DEBUG, LOG_TAG, "setup_location_manager: Failed to register location_updated callback for the Location Manager.");
        service_app_exit();
    }

        //THE LOGGER SHOWS THIS ON THE SCREEN
    dlog_print(DLOG_DEBUG, LOG_TAG, "setup_location_manager: Location Manager has been initialized successfully.");
}

void start_location_manager()
{
    handle_start_location_result(location_manager_start(location_manager));
}

void handle_start_location_result(int start_location_result)
{
    switch(start_location_result)
    {
        //Location Settings for the device are OFF
        case LOCATIONS_ERROR_GPS_SETTING_OFF:
            dlog_print(DLOG_DEBUG, LOG_TAG, "handle_location_manager_start_result: Please turn on the GPS Settings.");
            //service_app_exit();
            break;

        //Location Service is unavailable
        case LOCATIONS_ERROR_SERVICE_NOT_AVAILABLE:
            dlog_print(DLOG_DEBUG, LOG_TAG, "handle_location_manager_start_result: Location Service is currently unavailable. Please try again later.");
            //service_app_exit();
            break;

        //Location Service not supported
        case LOCATIONS_ERROR_NOT_SUPPORTED:
            dlog_print(DLOG_DEBUG, LOG_TAG, "handle_location_manager_start_result: Location Service is not supported on the current device.");
            //service_app_exit();
            break;

        //Location Manager is started successfully
        case LOCATIONS_ERROR_NONE:
            //THE LOGGER SHOWS THIS LINE
            dlog_print(DLOG_DEBUG, LOG_TAG, "handle_location_manager_start_result: Location Manager has been started working.");
            break;
    }
}

//LOGGER DOES NOT SHOW ANYTHING FROM HERE ONWARDS
void location_state_changed_callback(location_service_state_e state, void *user_data)
{
    dlog_print(DLOG_DEBUG, LOG_TAG, "location_state_changed_callback: Location Service State: %s", state);
    location_service_state = state;
    if (state == LOCATIONS_SERVICE_ENABLED)
    {
        dlog_print(DLOG_DEBUG, LOG_TAG, "location_state_changed_callback: Location Service is enabled now.");
        get_location_information();
    }
}

The log file shows the folliwng lines related to Location:

  1. setup_location_manager: Location Manager has been initialized successfully.

  2. handle_location_manager_start_result: Location Manager has been started working.

After this I don't get any update from the location_state_changed_callback. Rechecking the source of the code also didn't help.

Itban Saeed
  • 1,660
  • 5
  • 25
  • 38

1 Answers1

0

The usage of location APIs is correct and initialization of location manager is also successful. It would be helpful for us if you can send logs for failure analysis.

  • 1
    This does not provide an answer to the question. Once you have sufficient [reputation](https://stackoverflow.com/help/whats-reputation) you will be able to [comment on any post](https://meta.stackexchange.com/questions/214173/why-do-i-need-50-reputation-to-comment-what-can-i-do-instead); instead, provide [answers](https://stackoverflow.com/help/how-to-answer) that don't require clarification from the asker. – Anna Nov 29 '19 at 04:54