Tips for conserving battery if CoreLocation must constantly retrieve the user's location?

我是研究僧i 提交于 2019-12-13 16:23:08

问题


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?


回答1:


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 :)




回答2:


My iphone app runs 8 hours of recording fixes evey second on iphone4. The display needs much more power. Dont worry. Measure how long you can record. Then claim, not before.



来源:https://stackoverflow.com/questions/13538051/tips-for-conserving-battery-if-corelocation-must-constantly-retrieve-the-users

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