CLLocationManager Update frequency

拜拜、爱过 提交于 2020-01-16 04:57:39

问题


I have configured locationManager as follows.

_locationManager = [[CLLocationManager alloc] init];
[_locationManager setDelegate:self];
[_locationManager setDesiredAccuracy:kCLLocationAccuracyNearestTenMeters];
[_locationManager setDistanceFilter:kCLDistanceFilterNone];

When the application runs, I get some updates from the delegate methods. And when I do not change the location, and the mobile is stationary for about 2 hrs, I receive about 10-12 updates in the first 10 mins, and then stop receiving updates.

What I understand is that desiredAccuracy is how long the device will keep trying more and more accurate methods to get the current location. So in my case, it takes about 10 mins to get the desired accuracy.

I want to confirm if this is true. Also is there a way where I can get regular location updates even if the device is not moving?


回答1:


Why would you expect the location to be updated if it hasn't changed?

If you want to periodically refresh your results, use an NSTimer you've created yourself.


When the device gets a location with a margin of error < desiredAccuracy, it will stop asking for more accurate results. If the device moves then it will start asking again, until it once again gets the location to the desired accuracy.

If you're specifying 10m for the accuracy then you're almost certainly going to be relying on GPS - cell towers and wifi aren't that accurate (usually).

To determine if the device has moved, it uses distance filter - by setting this to none you are asking it to be accurate to the nearest 10m all the time - this is probably going to be quite draining on the battery ;)



来源:https://stackoverflow.com/questions/8803961/cllocationmanager-update-frequency

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!