gpslogger icon indicating copy to clipboard operation
gpslogger copied to clipboard

Measure distance travelled with the phone motion detection and with gps

Open Shaguito87 opened this issue 10 months ago • 5 comments

Gps lies when you not are in movement making false reads of your position, of course the app continue registering this reads as long as you are active, and inform that you are travelled more than you really travelled, so instead of registering with gps all the time, if you travelled certain distance, let the phone deciding if you are in movement or not, for this add motion permission to add a motion detection in the app, so if you are in a place with no movement or with a little movement for example if you are in home or in work the app then know if you are in movement or not and will discard the fake travel

Shaguito87 avatar Feb 09 '25 13:02 Shaguito87

Indeed, this used to be a feature a long time ago. I used to detect any kind of movement with a certain level of confidence, and based on that I could say whether or not to log at all, thereby reducing noise.

Sadly the library for it, Activity Recognition API, is not FOSS, so not accepted on F-Droid.

Instead I'd have to find some open source implementation for it. The problem is, in the FOSS world, there's only SensorEventListener which can measure raw values, but doesn't do anything like saying what the activity is. eg there could even be movement that's considered staying still.

I have not been able to find any such open source library, it would be good to know if such exists. I also don't have the know-how to build my own model. I think I've found a dataset though? And maybe another one here. But I'd suspect even training a model would come with its own overhead, such as false positives, false negatives.

mendhak avatar Feb 11 '25 20:02 mendhak

How about something like this: https://stackoverflow.com/questions/14574879/how-to-detect-movement-of-an-android-device

And then have an option(s) in the settings to allow the user to adjust the sensitivity.

eng3 avatar Apr 03 '25 01:04 eng3

That's too complex which I wanted to avoid, especially providing calibration options over things I don't understand well, but while doing more searching I just found this.

https://developer.android.com/develop/sensors-and-location/sensors/sensors_motion#sensors-motion-significant

I haven't tried it but supposedly this could be the simplest to maintain option if it works as described. When some significant motion has happened, the sensor fires. That way, the user's device can decide what a 'significant motion' is, and that's one less headache for me. I would need to play with this, I suspect it'll have to combine with the timers.

mendhak avatar Apr 13 '25 14:04 mendhak

Sounds promising.

I do understand wanting to reduce headaches.. I'm just saying, it doesnt necessarily have to work perfectly. But providing someting basic with a knob a user can turn is a start and better than nothing.

There are other ways that might be simpler. Estimating the phone's current velocity and adjusting based on that. (ie. near 0 speed, increase interval, high speed, decrease interval). (I use an app to record GPS tracks and there is an option to not record when not moving. I assume this just measures velocity.) Or based on location. When near certain locations (ie home) increase interval) Or have an API that allows something like tasker/automate change it. Ofcourse then you have to maintain an API.

eng3 avatar Apr 13 '25 14:04 eng3

If testing is possible (and totally fine if not possible) I've put an APK here: https://github.com/mendhak/gpslogger/releases/tag/v134-rc1

The setting is available under Performance.

The significant motion sensor is determined by the OS.
I also think its performance differs device to device.

mendhak avatar Apr 14 '25 21:04 mendhak

An experimental setting has been added that makes use of significant motion sensor. The crap news is that it behaves wildly differently on different phones, the 'significant' bit is determined by something, but I can't tell what, it's not well documented. In some cases it would detect a few times and then give up, in some cases it has been very reliable.

v134 is now in the releases and Fdroid

mendhak avatar Jul 05 '25 08:07 mendhak