Hauk
Hauk copied to clipboard
Use low-accuracy location sharing mode when nobody is looking on a map
It is a waste of battery to keep reporting device location in high-accuracy mode if nobody is looking on a map anyway.
I suggest that when nobody is looking on a map, detect location in low-accuracy mode, and only switch to high-accuracy mode while someone is looking at the map.
Here's how I would probably suggest to implement this:
- The browser (that contains map component) should send to the server a message "I am looking at the map" every 15 seconds.
- A server receives such a message and sends it to every device within the group (maybe debounced, i.e. not more often than every 15 seconds).
- A phone by default uses low-accuracy mode, but if it receives a message from server, it switches to high-accuracy mode for the next 1 minute. If it receives the message while it is already in high-accuracy mode, it just extends the timeout to a full 1 minute.
This is a good suggestion, and could also be paired with showing the number of current viewers in-app. Whenever the app sends a location update to the server, the number of current viewers could be returned as part of the response from the server. The client can then decide if it wants to switch to low-accuracy mode if there are no current viewers. I will probably consider adding this once I switch over to v2.0 of Hauk, as this requires a change to the Hauk network protocol, and I have several updates to the protocol lined up already that increase the complexity of the protocol too much for it to be feasible to maintain on the v1.x protocol spec.