GPS Service giving wrong data

GPS Service giving wrong data

BY 03 Jul 2015 Native Application Development

I am using given bellow  code to get GPS location in native app.It’s working but always given same location which is not my actual postion.

altitude: 37.800000

latitude: 37.253665

longitude: 127.054953 …which is note my actual position.

 

My actual lat long position is…

latitude: 23.7489959

longitude:90.3917064

 

Sample Code:

static void
get_current_location(appdata_s *ad)
{
    double altitude, latitude, longitude, climb, direction, speed;
    double horizontal, vertical;
    location_accuracy_level_e level;
    time_t timestamp;

    int ret = location_manager_get_location(ad->manager, &altitude, &latitude, &longitude, &climb, &direction, &speed, &level, &horizontal, &vertical, &timestamp);

dlog_print(DLOG_INFO, LOG_TAG, “%f %f”, latitude, longitude);

}
static void
position_updated(double latitude, double longitude, double altitude, time_t timestamp, void *user_data)
{
    appdata_s *ad = (appdata_s*)user_data;

    dlog_print(DLOG_INFO, LOG_TAG, “%f %f”, latitude, longitude);

}
static location_service_state_e service_state;
static void __state_changed_cb(location_service_state_e state, void *user_data)
{
    service_state = state;  

   get_current_location((appdata_s*)user_data);

}
static void
start_location_manager(appdata_s *ad)
{
    int ret = location_manager_create(LOCATIONS_METHOD_GPS, &ad->manager);
    ret = location_manager_set_service_state_changed_cb(ad->manager, __state_changed_cb, (void*)ad);
    location_manager_set_position_updated_cb(ad->manager, position_updated, 2, (void*)ad);
    ret = location_manager_start(ad->manager);
}

Looking for help….

Written by