39

Is it possible to read from local storage and track geolocation in PWAs with a service worker while app is not open on phone (in background)

So far my research is pointing to no, and I am finding that the PWA needs to be open for location services.

Thank you,

Blue Space
  • 627
  • 2
  • 7
  • 12

1 Answers1

35

The solution is at hand and has been for some years now as this POC clearly testifies. Unfortunately W3C have fought tooth and nail to prevent it from being made available :-(

Why? I know not. The "cui bono" argument points to plug-in vendors such as Ionic whose whole raison d'etre appears to be background geolocation.

See this link for complete story.

Leibale Eidelman
  • 2,772
  • 1
  • 17
  • 28
McMurphy
  • 1,235
  • 1
  • 15
  • 39
  • 2
    Thank you for the info, read a few things about this prior and was hoping there was more movement for it cause the articles that I read were older and PWA concept seems to be a fast changing landscape at this point. – Blue Space Jan 16 '19 at 01:41
  • 3
    Please contribute to https://github.com/w3c/geolocation-api/issues/74 – McMurphy May 04 '21 at 06:30
  • 1
    If every installed service worker could track a person's movement wither the client page/app was open or not, that would be a serious privacy intrusion. You'd need a permissions flow before you could even think of doing that and you'd probably want app permissions to be visible from a device's permissions page. – StormyKnight Mar 02 '22 at 21:22
  • 4
    Are there any news on this? I don't understand why this is such a big argument, specially with the line between PWA and native apps getting more and more blurry... I am developing a mountaineering PWA which is going to have to have background location recording pretty soon... If there is a still open Github issue on which I could make my voice heard I'd be happy to do so. – Tim Jan 31 '23 at 22:08
  • @McMurphy I would lika a clarification, do you mean that you can use Ionic in a PWA to get background geolocation? I have no experience with Ionic and I can't find that this is possible without building a native app in the documentation. Thanks in advance! – flafffl Aug 29 '23 at 13:24
  • I believe the PhoneGap-esque products have their own browser running within a native app with access to native APIs that PWAs do not. But I have not tried. Others may have had more fruitful experiences but sadly PWAs are still deprive of this water shed functionality for no good reason. – McMurphy Aug 31 '23 at 06:58