Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Subscription to location updates can lead to excessive battery usage #47

Closed
oonoo opened this issue Aug 27, 2015 · 2 comments
Closed

Subscription to location updates can lead to excessive battery usage #47

oonoo opened this issue Aug 27, 2015 · 2 comments

Comments

@oonoo
Copy link

oonoo commented Aug 27, 2015

If i make a subscription to get regular position updates, the requests are never emptied thus the location manager is always running. And it is always running in the mode desiredAccuracy kCLLocationAccuracyBest. But i don't need this accuracy which needs so much battery power. I have no option to change to desiredAccuracy.

@oonoo oonoo changed the title Subcription to location updates leeds to too much battery use Subcription to location updates leads to too much battery use Aug 27, 2015
@oonoo oonoo changed the title Subcription to location updates leads to too much battery use Subcription to location updates can leads to too an unnecessary amount of battery use Aug 27, 2015
@smileyborg
Copy link
Contributor

Hi @oonoo,

You are correct, INTULocationManager runs with kCLLocationAccuracyBest. For the regular one-time requests, this is actually not a problem, because as soon as the requested accuracy has been achieved, the request is completed, and once all requests have been completed location services are powered down.

For the newer subscription API, there is currently no way to specify the desired accuracy, which would be required to let INTULocationManager know what kind of -[CLLocationManager desiredAccuracy] to use.

I definitely think that this would make a good enhancement: to add another API for starting a subscription, which includes a desired accuracy parameter. (The existing subscription API will continue to default to "best".) This will require a little bit of work, because internally, INTULocationManager will need to dynamically adjust the desiredAccuracy setting on CLLocationManager based on the highest accuracy requirement of all current location requests.

Does that make sense? If you'd like to submit a pull request with this enhancement, that would be great! Otherwise it may be something that can be included with the next release (alongside #45).

@smileyborg smileyborg changed the title Subcription to location updates can leads to too an unnecessary amount of battery use Subscription to location updates can lead to excessive battery usage Aug 31, 2015
@smileyborg
Copy link
Contributor

Please take a look at the changes in be2dcee, I've implemented a new public API and some internal enhancements to support this!

felix-dumit pushed a commit to felix-dumit/LocationManager that referenced this issue Nov 13, 2015
- Add a new public API for location update subscriptions that allows a specific desired accuracy to be requested. By default, subscriptions use the maximum accuracy of location services, however this comes at the cost of high power consumption and therefore battery drain. By passing a lower desired accuracy, INTULocationManager will automatically reduce the location services accuracy level if possible to conserve power.
- Implement dynamic location services accuracy management, so that INTULocationManager automatically adjusts the location services accuracy level based on the requested desired accuracies of all active location requests. For example, if a location update subscription is using the lowest accuracy level, but a new location request comes in that has a higher desired accuracy level, INTULocationManager will automatically increase the location services accuracy until the second request has completed, at which point it will scale back the location services accuracy to conserve power.

Closes intuit#47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants