Minimum radius for iOS CLRegion for LocatinManager

I am currently working on a regional location manager function. Unfortunately, I cannot receive notifications of any border crossings that are less than 100 m. I have created areas with a radius of 20 m / 50 m or 70 m, and I always get a notification as soon as I cross the 100 m border. But I I would like to have a thinner radius - for example. 20 m, and receive a notification for this. Everything works very well if I have a range that exceeds 100 m - for example. 150m In this case, I receive a notification as soon as I enter 150 m, as expected.

I tried playing around with the "kCLLocationAccuracy" settings in the LocationManager and creating CLRegions, but they both don't seem to have any effect.

This is my code that I use:

- (void) initializeLocationManager { // Check to ensure location services are enabled if(![CLLocationManager locationServicesEnabled]) { [self showAlertWithMessage:@"You need to enable location services to use this app."]; return; } if(![CLLocationManager regionMonitoringAvailable]) { [self showAlertWithMessage:@"This app requires region monitoring features which are unavailable on this device."]; return; } self.locationManager = [[CLLocationManager alloc] init]; self.locationManager.delegate = self; self.locationManager.desiredAccuracy = kCLLocationAccuracyBest; self.locationManager.distanceFilter = kCLDistanceFilterNone; // whenever we move } - (void) setupGeoFence:(Station*)station { CLLocationCoordinate2D centerCoordinate = CLLocationCoordinate2DMake([station.gpsPosition.latitude doubleValue], [station.gpsPosition.longitude doubleValue]); CLRegion *geofence = [[CLRegion alloc] initCircularRegionWithCenter:centerCoordinate radius:[range doubleValue] identifier:station.name]; [self.locationManager startMonitoringForRegion:geofence desiredAccuracy:kCLLocationAccuracyBest]; } 

Does anyone have an idea how to get notified at a closer border? Any help would be greatly appreciated.

Thanks Hamtho

+4
source share
1 answer

Regions of this size are simply impossible. Location events are primarily triggered by Wi-Fi surrounding the device. GPS is not used unless absolutely necessary. Thus, the regions under 50 M are really crappy shooting. I spoke with CoreLocation engineers about this (along with some other odd behaviors surrounding the monitoring of the region), and due to Wifi dependency, sizes that are not recommended are not recommended. They actually recommend 150M, even if they are not documented.

If you really need location refinements that may be fine grained, you may need to do your own checks or run GPS to get a very accurate read. This happens with a battery hit, so your mileage may vary. Good luck.

+8
source

Source: https://habr.com/ru/post/1492728/


All Articles