1

So I'm using HIGH_ACCURACY to retrieve location data from my phone using FusedLocation solution. I'm already checking accuracy of this data and speed, but what I want to achieve is to understand if user is actually moving OR is it a location drift?

I have a location buffer of 20ish locations that I update all the time (when new location comes in, it replaces old one). My guess is that when there's a drift, GPS location points are scattered on the map in a circle like object, whereas if user is truly moving, it should look more like a line on a map (road).

How can I analyze my locations to understand if they are line-like or circle-like? I had an idea of snapping them to road, but that seems to be too expensive as API is a paid one. Other option would be to create a LatLng bound (rectangle) and then somehow see how many points are inside of it and how much are outside - if majority are inside, that might signal that it's a drift?

Any other ideas and pseudo-code? Thanks in advance.

MaaAn13
  • 264
  • 5
  • 24
  • 54
  • 1
    Maybe [this](https://stackoverflow.com/questions/35745924/location-from-gps-provider-or-network-provider-in-android-is-not-consistent/35750528#35750528) can help. – TDG Feb 19 '23 at 07:38
  • 1
    What about checking the accelerometer data at the same time when the movement is negligible? Surely a user moving will register deviations in the accelerometer. – Fco P. Feb 21 '23 at 16:50
  • @FcoP. Accelerometer is not enough, as user can be using the phone in his hands and doing a shake-like movement, which would trigger accelerometer, but GPS drift might still happen. Maybe accelerometer can help in combination of other solution, but not on it's own, imho. – MaaAn13 Feb 22 '23 at 07:06
  • You can wait to get location points that exceed the [accuracy of GPS locations](https://developer.android.com/reference/android/location/Location#getAccuracy()) with of course the higher the distance, the greater the probability of movement, but as you probably realize detecting accelerometer/gyroscope data for walking is different than if the device is in a vehicle. – Morrison Chang Feb 26 '23 at 03:21

0 Answers0