Friday, October 31, 2014

Tips for Optimizing the battery power on iOS devices - Location Manager

Turn off location services when not in use
This guideline is obvious but worth repeating. Unless the application is a turn by turn navigation app, it doesnt need to get the direction very often. After getting the location once, application can turn off the location monitoring. 

Use Significant location change service instead of standard location service whenever possible.: 
This enable app to leave the location services still running while using only low power. This is recommended for apps that need to track changes in user’s location but don’t need higher precision offered by the standard location services. 

Use lower-resolution values for the desired accuracy: 
Using highest accuracy makes the device to power up additional hardware to determine the location. Unless the app need highest accuracy in few meters, application should not use accuracy values such as kCLLocationAccuracyBest OR kCLLocationAccuracyNearestTenMeters in the desired accuracy property. Also to note that providing value kCLLocationAccuracyThreeKilometers doesnt prevent system from returning a better accurate data. Most of the time core location can return better accurate data within 100 metres or so. 

Turn off location monitoring if the accuracy doest improve
By checking accuracy value for a period of time and if it doesn’t improve over a period of time, then turn off the notification and retry later so that it will save the power. 

Specify the activity type of the app
Letting core location know what type of activity is associated with the app (for e.g. whether it is automobile navigation app or a fitness app) helps the location manager determine the most appropriate time to pause the location updates when app is in the background. This can improve the battery life of the device

Allow location manager to defer the delivery of location updates when your app is in the background. 

When the app can’t do anything useful with the location updates it receives from the location manager - other than log the info and go back to sleep - allow the location manager to defer those updates until they are meaningful to the app.

references: 
https://developer.apple.com/library/ios/documentation/UserExperience/Conceptual/LocationAwarenessPG/CoreLocation/CoreLocation.html

No comments:

Post a Comment