Discussion:
[whatwg] Popular Background Geolocation question on StackOverflow
Richard Maher
2018-03-18 23:25:27 UTC
Permalink
FYI This question on StackOverflow has now had over 1000 views: -
https://stackoverflow.com/questions/44233409/background-geolocation-serviceworker-onmessage-event-order-when-web-app-regain

Please explain why nothing is happening.
Philipp Serafin
2018-03-24 20:15:34 UTC
Permalink
If this problem is specific to the "track a route" use-case, and the
use-case is sufficiently widespread, would a dedicated "route recording"
API make sense?

E.g., a web page could ask the browser to continously record location
changes and - at some time at the browser's discretion - push a list of
recorded changes to the page.

This would allow the browser to record locations changes with reasonably
accuracy *without* waking up service workers.

It would also provide some hooks for privacy controls: A browser could show
a status indicator whenever it's in "GPS recording" mode. It could also
notify the user when it's about to push the recorded route to the page and
possibly even show the route for confirmation.
Post by Richard Maher
Post by Richard Maher
FYI This question on StackOverflow has now had over 1000 views: -
https://stackoverflow.com/questions/44233409/background-geolocation-serviceworker-onmessage-event-order-when-web-app-regain
Post by Richard Maher
Please explain why nothing is happening.
It has a accepted solution.
But one key issue is that browers throttle down or even pause inactive
windows/background tabs.
Partly blame digital currency mining for this, blame the rest on bad
programmers running full tilt when they don't need to and DDOS trojans
for the rest.
I haven't looked this up, but is there a way to ask the user for
permission to run as a background app without performance restrictions?
That is the only way I forsee this working across all browsers.
--
Unless specified otherwise, anything I write publicly is considered
Public Domain (CC0). My opinions are my own unless specified otherwise.
Roger Hågensen,
Freelancer, Norway.
Andy Valencia
2018-03-24 21:32:29 UTC
Permalink
Post by Philipp Serafin
If this problem is specific to the "track a route" use-case, and the
use-case is sufficiently widespread, would a dedicated "route recording"
API make sense?
E.g., a web page could ask the browser to continously record location
changes and - at some time at the browser's discretion - push a list of
recorded changes to the page.
Playing audio is already a special case; the tab with the active
<audio> element will almost certainly not have its setTimeout's
honored until it comes back to foreground. But the "ended" event
will get to run, at least long enough to move to the next track.
In fact, it can XHR and get to run/play-next on the completion.

(But wait, on slower tablets Firefox doesn't allow quite enough
CPU to keep the background mp3 playing. Oops.)

Or think about the iterations in the space of downloads (XHR,
service worker background fetch, background sync).

There are lots of apps using long-polling which would also like
to have some explicit (standards based) answers to their needs
to run when not the current tab--messaging and telemetry apps,
for instance.

And here we are thinking about a hand crafted solution for GPS backgrounding.

We're all well aware of the behaviors which make browsers adopt such
defensive measures. Are we looking at enough use-cases to think about some
sort of general authorization for background resource consumption, rather than
continuing the point solution approach?

$0.02,
Andy Valencia

Loading...