views:

220

answers:

1

I am new to iphone development.I want to know the working process of the CLLocationManager in determining the current location. I have used the below code for the button event to find the current location.

 self.locationManager = [[[CLLocationManager alloc] init] autorelease];

self.locationManager.delegate = self; // Tells the location manager to send updates to this object

[locationManager startUpdatingLocation];

IN

- (void)locationManager: (CLLocationManager *)manager didUpdateToLocation: (CLLocation *)newLocation fromLocation:(CLLocation *)oldLocation
{   }

I have determined the lat and long values and loaded the current location.

It working fine, i want to know only one thing, If after updating to the new location will it be once again called to get the current location .If iphone doesnot able to find the current location,will then once again search for current location.

I want to know for both cases

1.If iphone determines the current location.

2.If iphone doesn't able to determine the current location.

Please help me out.Thanks.

A: 

According to the CoreLocationManager reference

The location service returns an initial location as quickly as possible, returning cached information when available. After delivery of the initial event notification, the CLLocationManager object may deliver additional events if the minimum threshold distance (as specified by the distanceFilter property) is exceeded or a more accurate location value is determined.

That seems to indicate that (1) you may received cached location information while it's still trying to determine your current location, (2) you may receive multiple updates as it determines the location more accurately.

David Gelhar