CoreLocation必须不断检索用户的位置才能保存电池的提示? [英] Tips for conserving battery if CoreLocation must constantly retrieve the user's location?

查看:161
本文介绍了CoreLocation必须不断检索用户的位置才能保存电池的提示?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

应用程序将选择随机的经纬度来创建用户必须找到的点。

用户距离该点的距离将使用热冷表显示,该表会根据距离改变颜色。该仪表必须不断更新,这将需要我不断检索用户的位置。我还需要使用 kCLLocationAccuracyBest 。然而,这听起来像会耗尽大量电池。



我可以做任何事情来节省电池吗?

解决方案

来自官方文档


收集位置数据是一项耗电量大的操作。它包括启动机载无线电和查询可用的蜂窝塔,Wi-Fi热点或GPS卫星,这可能需要几秒钟的时间。让标准位置服务长时间运行可能会耗尽设备的电池。 (重大更改位置服务通过仅监视手机信号塔变化大幅降低电池消耗,但该服务仅适用于手机无线电的设备。)对于大多数应用程序,通常只需建立初始位置修复并仅定期采集更新即可之后。如果您确定需要定期更新位置,则应尽可能使用重大更改位置服务;否则,您应该以最小化其对电池寿命的影响的方式来配置标准位置服务的参数。

http://developer.apple.com/library/ios/ #documentation / userexperience / conceptual / LocationAwarenessPG / CoreLocation / CoreLocation.html



PS:在同一个链接的页面底部有一个部分,提示太:)


The application will select a random latitude and longitude to create a point which the user must find.

The user's distance from the point will be displayed using a "hot-cold meter", which will change color depending on the distance. This meter must constantly update, which would require that I constantly retrieve the user's location. I would also need to use kCLLocationAccuracyBest. However, this sounds like it would use up a lot of battery.

Can I do anything to save battery?

解决方案

From the official documentation

Gathering location data is a power-intensive operation. It involves powering up the onboard radios and querying the available cell towers, Wi-Fi hotspots, or GPS satellites, which can take several seconds. Leaving the standard location service running for extended periods can drain the device’s battery. (The significant-change location service drastically reduces battery drain by monitoring only cell tower changes, but the service works only on devices with cellular radios.) For most apps, it is usually sufficient to establish an initial position fix and then acquire updates only periodically after that. If you are sure you need regular position updates, you should use the significant-change location service where you can; otherwise, you should configure the parameters of the standard location service in a way that minimizes its impact on battery life.

http://developer.apple.com/library/ios/#documentation/userexperience/conceptual/LocationAwarenessPG/CoreLocation/CoreLocation.html

PS: On the same link there's a section at the bottom of the page with other tips too :)

这篇关于CoreLocation必须不断检索用户的位置才能保存电池的提示?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆