I'm currently measuring the distance how far the user walked/runned/etc. When I'm comparing my results with results from other apps my result is not that accurate as the others (i.e 100m which are correct and my result is around 50m). So how can I improve my accuracy to get more accurate results?
What I'm doing so far is:
Init the CLLocationManager:
locationManager = [[CLLocationManager alloc] init];
locationManager.desiredAccuracy = kCLLocationAccuracyBest;
locationManager.delegate = self;
locationManager.distanceFilter = 10;
and:
- (void) locationManager:(CLLocationManager *)manager didUpdateLocations:(NSArray *)locations
{
CLLocation *lastLocation = [locations lastObject];
NSTimeInterval age = -[lastLocation.timestamp timeIntervalSinceNow];
if (age > 30.0) return;
if (lastLocation.horizontalAccuracy < 0) return; // ignore invalid updates
if (previousLocation == nil || previousLocation.horizontalAccuracy < 0)
{
previousLocation = lastLocation;
return;
}
CLLocationDistance distance = [lastLocation distanceFromLocation:previousLocation];
if ([delegate respondsToSelector:@selector(currentDistance:)])
{
[delegate currentDistance:distance];
}
previousLocation = lastLocation;
}
Cheers!