traccar / traccar-client-android

Traccar Client for Android
https://www.traccar.org/client
Apache License 2.0
664 stars 736 forks source link

Ability for request interval to adapt automatically #288

Open luke-jr opened 7 years ago

luke-jr commented 7 years ago

Currently, Traccar Client monitors GPS constantly (request interval 1 second) when distance/angle reporting are enabled. This drains battery unnecessarily when not in motion.

Instead, there should be an option to adapt the request interval based on past movement. If the last check showed no movement, the request interval should be the reporting period. When movement begins, the request interval should be 1s until it figures out the rate of movement, and adapt GPS polling as expected.

In other words, for example, while stationary, GPS should only be polled every 5 minutes (or whatever is configured). When moving in a car, perhaps every 15-30 seconds (based on configured distance reporting). When walking, maybe every few minutes.

tananaev commented 7 years ago

It means that we can potentially miss some information on transition from stationary to moving state.

luke-jr commented 7 years ago

Yes, it does. But that's better than never getting more frequent updates, and better than constantly draining the battery.

tananaev commented 7 years ago

It depends on the use case.

Anton-V-K commented 6 years ago

I'm not aware of the technical details, but I guess the transition from stationary to moving state could be easily detected with the help of accelerometer...

tananaev commented 6 years ago

Except for the fact that accelerometer uses a lot of battery power itself.

Anton-V-K commented 6 years ago

I wasn't able to find exact measurements of power consumption for different sensors, but my gut feeling tells me the accelerometer may consume much less power than GPS reciever... And according to API guide: "Almost every Android-powered handset and tablet has an accelerometer, and it uses about 10 times less power than the other motion sensors". See also #128