Skip to content
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

Fetch user location as background process #2

Closed
marcveens opened this issue Aug 21, 2018 · 1 comment
Closed

Fetch user location as background process #2

marcveens opened this issue Aug 21, 2018 · 1 comment
Labels
research Do some research

Comments

@marcveens
Copy link
Member

Figure out if it's possible to fetch the user's location as a background process.

Goal: We would like to send a user messages based on their location and time.

@marcveens marcveens added the research Do some research label Aug 21, 2018
@marcveens
Copy link
Member Author

Seems that it's not possible to fetch location using a service worker, see w3c/ServiceWorker#745.

There is a specs draft by W3C, but it's written in 2016 and no longer maintained: https://w3c.github.io/geofencing-api/.

There is a still active proposal for Geofencing in a PWA, but still no outcome: https://discourse.wicg.io/t/proposal-expose-geolocation-to-service-workers/2588/30.

There are a few alternatives:

  • Jake Archibald (one of the designers of the ServiceWorker) suggests to look at https://w3c.github.io/wake-lock/. This should keep the page alive, not by using a ServiceWorker. Support seems to be poor. Needs more research
  • Keep track of user location and time on the website everytime they open it. For example: User opens website at 8:00 at location A and opens it again at 12:00 at location B. We already know the time in between the 2 actions, for distance we have two options:
    • Calculate the approximate distance as the crow flies (hemelsbreed) (Not very accurate)
    • Calculate a more precise distance using a geoservice (by Google Maps API or another service) (Accurate, slower to fetch, might have to be paid for)
      Based on this data we know how long someone has been on the road.
  • Create a hybrid web app in order to use Geofencing, which is supported natively: (https://ionicframework.com/docs/native/geofence/) (This is probably the worst solution of all, since we want a PWA)

@macaw-cad macaw-cad deleted a comment from Bullet55NL Aug 21, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
research Do some research
Projects
None yet
Development

No branches or pull requests

1 participant