owntracks / ios

OwnTracks' iPhone App
http://owntracks.org
Other
331 stars 91 forks source link

Timer related location is not updated #781

Closed galak75 closed 6 months ago

galak75 commented 7 months ago

Hi

I have a question related to the move mode on iOs mobile app:

In the location documentation, we can read:

In move mode, the app monitors location permanently and publishes a new location as soon as the device 
moves locatorDisplacement meters or after locatorInterval seconds, whatever happens first.

After experimenting a few things, I realized that every time related message sent by the iOs application reuses the latest GPS location information (coordinates, speed and timestamp) triggered by the displacement related message. An additional created_at timestamp is then added, but speed and coordinates remains the ones measured for the last displacement related message (could be a long time ago in some scenarios).

Note : I'm currently using the http mode to send messages to my back-end

Is there an option to make sure GPS location information (coordinates and speed) is updated on each time related message?

ckrey commented 7 months ago

Not that I know of. OwnTracks requests updates from iOS and uses the last available location when triggered locatorInterval. E.g. when you don’t have GPS because you are in a building or if you don’t move, iOS will not provide updates to the app. Which are your scenarios?

galak75 commented 7 months ago

Thank you so much for answering so quickly!!

If I understand correctly, the mobile app can not ask for a GPS location on demand, but rather iOS decides when a new GPS location is available? (and the mobile app is requesting for this iOS available latest GPS location) Is that correct?

For information, here is my scenario: I'm trying to track a car movements (fine grained tracking). Ideally I would like to receive a new location every 5 seconds. So I configured locatorDisplacement to 50 meters and locatorInterval to 5 seconds.

Then, I should probably configure a much higher locatorDisplacement, so I rely only on time related messages. Doing so, I would receive the same GPS location as long as iOS considers the phone did not move (or as long as GPS signal is not available). I'll give it a try.

ckrey commented 7 months ago

To get the finest grain, you should set locatorDisplacement to 0 (zero), which disables filtering. locatorInterval does sent additional messages even if the device did not move. Try setting this to a relatively high value e.g. 180 for 3 minutes

galak75 commented 7 months ago

I tried locatorDisplacement to 50.000 meters and locatorInterval to 5 seconds, then took a walk, went for lunch, took a walk again (about 1.5 km walking). Then I checked the received messages on backend side : the exact same values on properties tst, lon, lat, vel for 2 hours... Is it possible that this behavior depends on iOS version ? (i'm running iOS 17.3.1 on an iPhone SE)

I'll give a try to your suggestion and give you some feedback

galak75 commented 7 months ago

I tried your suggestion : locatorDisplacement set to 0 meter and locatorInterval to 3600 seconds. You're right, it's the finest grain tracking: I'm receiving one message every second, with a new timestamp for each, even when the phone is put on a desk, absolutely stationary. It's probably a bit to fine for my use case.

I'm wondering why my previous experiment did not work as expected : I was hoping to receive a new GPS location every 5 seconds. Especially while walking in the streets.

galak75 commented 6 months ago

I tried locatorDisplacement to 50.000 meters and locatorInterval to 5 seconds, then took a walk, went for lunch, took a walk again (about 1.5 km walking). Then I checked the received messages on backend side : the exact same values on properties tst, lon, lat, vel for 2 hours... Is it possible that this behavior depends on iOS version ? (i'm running iOS 17.3.1 on an iPhone SE)

Is it possible there is a bug here : my backend received some data every 5 seconds, as expected, but it was the exact same GPS feature all along the trip.

ckrey commented 6 months ago

I tried locatorDisplacement to 50.000 meters and locatorInterval to 5 seconds, then took a walk, went for lunch, took a walk again (about 1.5 km walking). Then I checked the received messages on backend side : the exact same values on properties tst, lon, lat, vel for 2 hours... Is it possible that this behavior depends on iOS version ? (i'm running iOS 17.3.1 on an iPhone SE)

Is it possible there is a bug here : my backend received some data every 5 seconds, as expected, but it was the exact same GPS feature all along the trip.

As explained above, you will not get updated locations if you set locationDisplacement to a high value like 50 thousand meters. Why do you keep trying to do so?

jpmens commented 6 months ago

One of the most important things to understand is that we get what iOS gives us and nothing more.

On a related note, do you have +follow configured? [1] I think you might find this solves a lot of problems. (Hint: I've not modified any of the timing/distance parameters and rely on +follow only.)

[1] https://owntracks.org/booklet/features/ios/#region-monitoring-with-follow

galak75 commented 6 months ago

I tried locatorDisplacement to 50.000 meters and locatorInterval to 5 seconds, then took a walk, went for lunch, took a walk again (about 1.5 km walking). Then I checked the received messages on backend side : the exact same values on properties tst, lon, lat, vel for 2 hours... Is it possible that this behavior depends on iOS version ? (i'm running iOS 17.3.1 on an iPhone SE)

Is it possible there is a bug here : my backend received some data every 5 seconds, as expected, but it was the exact same GPS feature all along the trip.

As explained above, you will not get updated locations if you set locationDisplacement to a high value like 50 thousand meters. Why do you keep trying to do so?

I do not want to bother you; I'm really sorry if this is the case. This was an experiment I've done 3 weeks ago, before your previous answer.

What I'm trying to achieve is receiving an updated location every 5 seconds, whatever the displacement is. I thought this configuration was a good way to do it, but I must have misunderstood the location documentation (especially the sentence quoted in my initial question).

Thank you for your answers and for all the work you do to make all these applications available And I sincerely apologize if my comments or questions were inappropriate.

galak75 commented 6 months ago

One of the most important things to understand is that we get what iOS gives us and nothing more. On a related note, do you have +follow configured? [1] I think you might find this solves a lot of problems. (Hint: I've not modified any of the timing/distance parameters and rely on +follow only.) [1] https://owntracks.org/booklet/features/ios/#region-monitoring-with-follow

@jpmens thank you for your suggestion. I'll definitely try this configuration.

And for sure, I understand the application relies on what iOS is providing... I did not want to be rude at all, and i'm sorry if it looked like I was.


EDIT : I'm trying to receive an updated location every 5 seconds, whatever the displacement is. May this be impossible on iOS ?

galak75 commented 6 months ago

@jpmens : do you think it should be possible to get an updated location every 5 seconds? (whatever the displacement is)

Maybe is there an iOS limitation preventing this use case to be feasible ?

jpmens commented 6 months ago

@jpmens : do you think it should be possible to get an updated location every 5 seconds?

I do not know whether that is possible.

ckrey commented 6 months ago

The answer is:

The locatorInterval currently controls a trigger for an location update after given time in seconds even if no location update happened.

We could change the meaning of locatorInterval or introduce a new settings parameter locatorIntervalMinimum which filters out location updates happening within the time specified...

jpmens commented 6 months ago

I fear that @galak75 will never be satisfied with this. Their use-case is

I'm trying to track a car movements (fine grained tracking)

Whatl I can say is "we've been there, and have tried that, and we failed at it".

That's what vehicle trackers are for.

ckrey commented 6 months ago

I think I found a solution: The app will in future not rely on position filtering by iOS, but do this in code.

Everybody else will probably still be happy with the default locatorInterval 180 seconds and locatorDisplacement 200 meters.