开发者

GPS tracking and accelerometer

Do you think it's a good idea to chec开发者_StackOverflow社区k the accelerometer for movement in order to save battery when running a service which checks and sends GPS location? Or is the onLocationChanged method optimized in a way that this will not help since it's only called when the location changes anyway and checking the accelerometer uses battery too.

I was thinking I could turn my GPS tracking service on and off depending on accelerometer data. But if the system is already sufficiently optimized for GPS battery usage then maybe it doesn't make sense?


I would say this isn't the best way to go about it but it's certainly possible. You wouldn't be able to tell the difference between walking to the bathroom and walking down the street.

I would give the location listener a try and depending on the criteria you use, you might not see such a terrible battery drain.

I believe there is also a way to have your app receive a location when another app receives a location. Piggy-backing on it's location update. Depending on the location needs of your app this might be enough for you.


It is posible but another way to reduce gps updates is playing with the parameters of requestLocationUpdates with the minTime and MinDistance parameters, in the documentation is suggested to use updates times of more than a min.

depending on your updating frequency needs.

Using the accelerometer to trigger the updates my give you wrong data at the beginning and you might loose the initial real fixes, that depending on your needs that would be important or not.

In my case I'm working on similar app to track distance (and using the accelerometer but for different purpose) and when i start the gps listener I receive different readings even when standing still, it takes some time to settle, so this results on distance not traveled. currently looking how to solve this.


If your motive is to conserve battery power, locationListener is the best approach to go about. If your motive is to enable/disable GPS based on people's movements then the accelerometer is the way to go, though it's a bit tricky to figure out the required movement to trigger the GPS, because using an accelerometer to distinguish various types of movements - walking, running, moving in a car etc is very very tricky.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜