-
Notifications
You must be signed in to change notification settings - Fork 283
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
Optimize Location Logging #403
Comments
I spent a lot of time a few years ago thinking about how to optimize location logging and the solution I came up with was to (1 set) a minimum accuracy threshold and an optimum accuracy threshold, (2) run the location listener for different lengths of time depending on which threshold is reached and how many previous locations have been missed because the minimum threshold could not be reached. The basic idea is that you turn on the listener and start looking at the locations it returns. If you get a location within the optimal accuracy you use that and switch the listener off. If not, you keep listening for up to a predefined "normal" listening time and if you never hit the optimal accuracy within that time you take the best accuracy that is within the minimal threshold. If no location is within the minimal threshold, then you don't take anything and mark it as a missed location and move on to the next fix time. After a certain number of locations are marked as "missed" in a row, then the next time the listener is run you let it run for the "long" listening time. But if it keeps missing it, you go back to the "normal" time. (This is because the user could be in some place where there is simply no network or GPS signal and you don't want to keep draining the battery with long listening times in that case. I did not use the accelerometer approach you are proposing but I could see combining the two approaches. All of my code that I am describing is here, and the key part is:
|
If user activities were regular in nature, we could have taken the approach of thresholds on the wakelocks itself. Since in our context, the activities of a user could be quite irregular, I introduced an event-based mechanism to optimize on it. Also the sensor we use, is a simple one, and found in almost all of the phones. The advantage of having thresholds set over these sensor values would help filter the insignificant movements of a user, thus avoiding any false positives. Of course, identifying an optimal threshold value could be tricky, and as you rightly pointed, we may need to analyze the best possible values for the same. As you might have observed from the Sensor reference (of Android), we could perhaps use the following parameters ...
Activity Recognition APIs may need to be evaluated, and decide if they provide a better option. Also considering the resources that it may consume, and if it has any restrictions as compared to the one above. |
Closing this issue out as we have taken it into consideration and documented the feedback on this page in Jira. |
We could optimize location logs in order to save phone's battery consumption, and efficiently log user movements for further analysis. We introduce step-1 as given below, while step-2 could be present in the implementation.
Thus replacing "periodic wakelocks" being done every 5 minutes - the reason for fast power drain!
Reference for implementing on Android, using the SensorEvent API:
And likewise on the iOS.
The text was updated successfully, but these errors were encountered: