-->

Tips for conserving battery if CoreLocation must c

2019-07-11 07:25发布

问题:

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.