Reputation: 614
I ran into really strange situation while playing with CLLocaitonManager...
manager = [[CLLocationManager alloc] init];
[manager setDistanceFilter:kCLDistanceFilterNone];
[manager setDesiredAccuracy:kCLLocationAccuracyNearestTenMeters];
manager.delegate = self;
I'm using region tracking with regions which have 10.0 meters radius...
[manager startMonitoringForRegion:region];
My defined regions are quite close to each other but definitely not closer than 50-100 meters... When i'm testing my app in iOS (5.0) simulator (by setting location to Apple and then back to my custom location) i get several notifications at the same time, for regions which are close to each other... I'm also checking the distance between detected region location and my current location...
-(void)locationManager:(CLLocationManager *)manager didEnterRegion:(CLRegion *)region
{
CLLocation *regionLocation = [[CLLocation alloc] initWithLatitude:region.center.latitude longitude:region.center.longitude];
NSLog(@"didEnterRegion: %@ %f", region.identifier, [regionLocation distanceFromLocation:mapView.userLocation.location]);
[self notifyUserDidEnterRegion:region];
}
The problem is that i get notifications for regions which are for example 200 meters away from my current location... And I get few notifications at pretty much the same time...
Any suggestions? Or should i maybe provide more details?
Upvotes: 2
Views: 969
Reputation: 26383
region monitoring is just limited to that. Unfortunately you can't get a precision in a range of meters, they improved in iOS5 in a range of about 200m, but it depends about a lot of factors since it's based on cell tower triangulation and wifi spots. the only way that I found to get more precision is change the accuracy while you get close to the target and register again while you move away.For that you should activate multitasking for GPS, but if you implement well the algorithm it will not consume so much battery. Hope this helps, Andrea
Upvotes: 1