New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add AppleWatch Overland app #65

Open
EdwardHinkle opened this Issue Sep 13, 2018 · 2 comments

Comments

Projects
None yet
2 participants
@EdwardHinkle
Copy link
Contributor

EdwardHinkle commented Sep 13, 2018

I have a cellular Apple Watch, but I don't ever want to leave my iPhone because I use it to track my location. I'd love to be able to just go out with my Apple Watch and continue to track my location. On the Series 3 Apple Watch you can track GPS with Cellular on for 4-5 hours. Series 4 increases that to 5-6 hours. Definitely not "all day" tracking, but helpful for exercising and even maybe just running errands around town and tracking driving locations, etc.

I'm thinking through a couple of things:

  1. Should an AppleWatch app allow for FULL tracking or just Trip tracking?
  2. Is there a problem sending multiple device data to a server (specifically the Compass server).
    2b. If there is a problem with sending multiple device data to the server, we would probably want the watch and the app to communicate and if the watch turns on tracking, the app would turn off tracking and vice-versa.
@aaronpk

This comment has been minimized.

Copy link
Owner

aaronpk commented Sep 13, 2018

Compass, as well as this app, are all written with the assumption that there is only one source of location data. There are a bunch of edge cases that come up when you don't make this assumption which I wanted to avoid.

For example, I was able to simplify the storage format in Compass a ton by working under the assumption that data is always written in order. This allows me to use a drastically simplified filesystem structure instead of requiring a fancy database that can allow inserts at arbitrary locations.

Also querying the data becomes simpler when there is only one answer to "where were you at time X".

I'm not sure the best way to have the watch and phone coordinate on this, so it's worth a discussion.

@EdwardHinkle

This comment has been minimized.

Copy link
Contributor

EdwardHinkle commented Sep 13, 2018

Sounds good. I felt like that was probably the case but I didn't want to overthink it if it wasn't an issue.

You can push configuration settings between the Apple Watch app and the iPhone using a specific method. Essentially you could have a setting in the config that gets pushed between the apps that is called "activeDevice".

If you were tracking location on the phone, and you clicked to "start" tracking data on the watch. You could then change the activeDevice config to the watch's UUID and push the update to the phone.

When the phone received the updated configuration, it would check the activeDevice against it's own UUID and if it doesn't match and it is currently tracking location, it would turn off location tracking and push all the data currently on device to the server. The same could happen in the reverse if you pick up the phone and turn on tracking.

I think the only potential issue is do they overlap for a minute or two if the watch starts tracking and it takes a couple minutes for the data to get pushed to the phone and for it to compare the UUID, etc. The watch could have tracking data that overlaps with the last couple of minutes from the iPhone.

There are a couple ways that come to mind that we could attempt to fix that:

Delay Tactic
We could assume there is no issue with losing a couple of minutes worth of data and if the value of the activeDevice is NOT the current device when the "startTracking" is turned on, then the device could wait 5 minutes before actually beginning tracking, allowing time for the other device to turn off tracking and you might lose a couple of minutes of data but shouldn't have a profound effect.

Sync Tracking Times Tactic
The other option is you could have a "lastTracked" date/time in the config option. This means if you are tracking on the phone and turn on tracking on the watch, the watch would set the activeDevice to itself and send to the phone.

The phone receives the configuration and stops tracking, sets the current time to the lastTracked date/time config and pushes the config option back to the watch, while triggering a data push to the server.

When the watch receives the config option from the phone, it would check to make sure the lastTracked time has passed and it would begin tracking.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment