电池使用启动监控显著的位置变化和所需的准确性



我正在开发一个在后台运行的本地化应用程序。

我正在使用startMonitoringSignificantLocationChanges来获取用户的位置更新。

我知道这种方法只使用蜂窝塔来确定用户位置,但它节省了电池,即使它不是很准确。

我想知道,将这种方法与desiredAccuracydistanceFilter结合会有什么效果?

它仍然是不准确和电池友好的吗?

或者它真的会使用GPS并耗尽电池电量?

感谢

我的建议是使用两个CCLocationManager和委托方法

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

第一个用于startMonitoringSignificantLocationChanges,第二个用于[locationManager startUpdatingLocation]。我的意思是:你的主startMonitoringSignificantLocationChanges,以及你不时选择的如何做到这一点,当你得到第一个GPS位置坐标时,立即调用第二个locationManager[locationManager startUpdatingLocation],你称之为[locationManager stopUpdatingLocation]。这种方法可以节省能源,并且您可以收到一些desiredAccuracy GPS坐标。只需从开关locationManager来以及何时启动和停止GPS,就可以进行一些个人逻辑处理。

希望你能理解我的逻辑,否则我会写一些代码。现在我不在mac上了。

startMonitoringSignificantLocationChanges的文档说明:

它不依赖于distanceFilter属性中的值来生成事件。

据我所知,现在有一种方法可以告诉位置管理器将desiredAccuracy用于startMonitoringSignificantLocationChanges,从而阻止这种方法在后台"运行"的应用程序的节能特性。

最新更新