Closed irjayjay closed 2 months ago
Go outside and test on a real device.
If you read what I posted, you'll see that I did. In fact, I drove all the way to the shops and back and the odometer ended up on 0.0.
In another issue on here you told the person that this library is compatible with location spoofing, so it's interesting that you're telling me to go outside now.
I just tried again. Walked with my laptop and phone connected in debug mode. I could hear the debug audio prompts from the geolocation library, every few meters of movement. It made that iPhone message sound, to indicate movement about 5 times. Finally I triggered to fetch the odometer and it was 0.0 again.
I have a breakpoint set on setOdometer, it never triggered, so it's not that it gets set to 0.0.
I don't understand how the library is getting location updates, yet the odometer doesn't update.
I suggest you fetch the logs and have a look at them.
see api docs “.emailLog”
I figured something out. I tested with a distanceFilter of 3.0 yesterday. But disableElasticity was false. Later I disabled elasticity and it still didn't work, because at that time I think distanceFilter was 10.0.
I had this all work for me with elasticity enabled and distanceFilter 10.0 the other day, but I don't know how. I was walking at a normal pace and according to the calculations, only if I walked faster than 2.5m/s, then it would round up to 5m/s, which would count as 1 x distanceFilter meters travelled. So any time I travel less than 2.5m/s, it's like I'm not moving.
I'd say it should start off with 10.0, then add 10.0 for every 5m/s of speed from there on, otherwise you'll only record something when running or in a vehicle.
So I hit the sweet spot where no location updates would happen. Still weird that I could hear location updates earlier this morning, yet odometer stayed on 0.
Hope this helps future travellers.
This issue is stale because it has been open for 30 days with no activity.
This issue was closed because it has been inactive for 14 days since being marked as stale.
Your Environment
flutter doctor
):Expected Behavior
Odometer should update to a new value whenever location changes and the new value should be returned when doing either BackgroundGeolocation.getCurrentPosition() or inside the callback for BackgroundGeolocation.onLocation().
Actual Behavior
Odometer doesn't update, whether really moving a real device, or using location spoofing(Lockito), or android-emulator location spoofing. Setting distanceFilter to 1 and disableElasticity to true does not help this. In fact, onLocation() very rarely fires.
In fact, onLocation only fires when onLocation callback gets registered. I can see updated locations if I do a BackgroundGeolocation.getCurrentPosition() inside the onHeartbeat, but even this won't update the odometer. I'd expect any latest location fetch would update it.
The only workaround to get the odometer to record anything is to turn a location spoofing app (Lockito) on and off, which triggers an update onLocation too.
Steps to Reproduce
Context
Trying to record the odometer readings of a driver at the end of a trip.