owntracks / ios

OwnTracks' iPhone App
http://owntracks.org
Other
315 stars 90 forks source link

iOS OwnTracks Not Reporting Location as Expected to Self-Hosted OwnTracks Recorder #776

Closed rbrinson closed 3 months ago

rbrinson commented 4 months ago

This is more of a question. Sorry for the length, but I wanted to ensure that the use case was properly understood.

What I'm Trying to Achieve: In my family, there are 3 devices, 2 run Android (Google Pixel 7 Pro and One Plus 8T) and 1 runs the latest iOS on an iPhone 15. We have used Life360, which does provide the family tracking functionality that I am hoping to replicate. The problem that I have with Life360 is that I am handing my location data over to a third party and trusting them not to sell it or otherwise give it out to others. I consider it a matter of privacy. However, Life360 have done precisely that.

Steps Followed: So, I setup the OwnTracks Recorder in a Docker container with Nginx Proxy Manger in front of it to provide basic auth to the HTTP front-end. I used this tutorial as a guide for setting things up. After installing the Android and iOS apps on the devices and configuring them to point to my recorder instance with their basic auth credentials, I was able to map each device as a friend in the friends table, and we can all see each other in the client apps map.

The Problem: The problem that I am having is getting tracking data equivalent to Life360. I have read the Location section of the OwnTracks booklet, and from that I have gleaned that on Android, I just need to play with the "Minimal location displacement" and "Location interval" under Preferences | Advanced to fine tune the "Significant Changes" mode such that enough movement reports are generated to make the data relevant for my wife to see that I am at the gym or for me to see that she is still at the store. I also tried "Move" mode, which did produce a lot of data points, but I could see how that would have a negative impact on the battery.

My daughter has the iPhone 15, and iOS just doesn't want to actively report in to the OwnTracks recorder. I have tried both "Significant Changes" and "Move" modes. Yesterday, she traveled about 22 miles away. While she was away, I checked the recorder to see if any data points were being logged, and I noticed that there weren't any. When she got home, I opened the iOS OwnTracks app. When I then checked for data points, I found that about 5 dots appeared on the map showing the route taken. However, these only appeared after opening the app. I tried changing the mode to "Move" and updated the locatorDisplacement and locatorInterval to lower values. On Android, this caused many data points to be generated. However, on iOS, I haven't seen even one data point since that change.

I did note some mentions of having the app running in the background and "swiping" of the app discouraged. Does this mean that the iOS OwnTracks app must always be in the foreground to report properly? Does it mean that the iOS app can be an app in the background, but you cannot "swipe" it out? Either of these scenarios is not the way Life360 operated, and it's not even how the Android OwnTracks app operates. On Android, the OwnTracks app seems to have a background service running in the selected Location Mode even if the app is not in the foreground or even in the background carousel. Does anyone know of settings for Android and iOS OwnTracks that replicates Life360's movement tracking? Thanks for any insight!

ckrey commented 4 months ago

You are right, if you swipe out the iOS app it does not report anything anymore. On the other hand, there is no memory or performance penalty if you don't swipe out apps in iOS. Just start the app and then return to the menu screen. OwnTracks will then e.g. report your movements in "Significant Mode". If you want to have more timely enter/exit events, we recommend setting Regions for home, gym, school, etc. Region monitoring works very well in iOS Background ... as long as you don't kill the app by swiping it out

rbrinson commented 4 months ago

@ckrey, thank you for the quick response! I understand now why the iPhone isn't reporting back. I know that this is an open source project that you and others have contributed as a labor of love, and I do appreciate the level of effort put in to produce OwnTracks across the various platforms. However, I was curious if anyone from the OwnTracks team knows what Life360 does differently, as it seems to produce location data on both iOS and Android, even if an individual hasn't opened the app? Is that a "feature" that OwnTracks is exploring for its mobile clients? Thank you again for your hard work and dedication!

jpmens commented 4 months ago

@rbrinson most of us here use the OwnTracks apps (iOS and Android) without opening the app. When I or my friends boot an iPhone (with OwnTracs in significant mode as @ckrey suggested) we just go about our business and the app reports at regular intervals without our opening it.

I concur with Christoph: as soon as a user unnecessarily swipes out the app, all bets are off. There are thousands or articles explaining why that's a bad idea and that it saves nothing. Just don't do it.

rbrinson commented 4 months ago

@jpmens, thank you for your response. Personally, I have always used Android. So, I'm not as familiar with the iPhone, but I now better understand the way iOS does resource management. One last question. Reading the Location section of the booklet, it seems to suggest the "Significant Change" mode is predefined and set in stone by iOS. Can the values for distance and interval be configured for "Significant Change" mode, such that OwnTracks reports location data to the Recorder more frequently, or is that forbidden by iOS? Thank you again for all of the great work that you've contributed to the community!

jpmens commented 4 months ago

I'm still working on getting that portion of the Booket correctly described, and tbh I always forget: I think they're reserved (on iOS) for Move mode.

Be advised that I (as a heavyweight user of OwnTracks on iOS!) haven't touched those parameters and don't intend to. What I do have, and I reccomend you add that for your daughter is a region with the literal name +follow which you set up with a radius of 50 m. This is insofar a wee bit "magic" as this region sets a geofence of given radius around where I now am, and as soon as I move out there's typically a position report and the +follow region is reconfigured automatically to "here + 50m` whereupon the whole thing recommences. The fence moves along with me.

Try it. :-)

jpmens commented 4 months ago

@rbrinson have you been able to experiment with the +follow region?