-
Notifications
You must be signed in to change notification settings - Fork 2
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 #5
Comments
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:
|
I've done some research on getting the distance between 2 geolocations:
I've compared the Haversine accuracy with the OSRM service: |
I now have 4 fetch options: enum LocationSource {
PREDEFINED = 'predefined',
MANUAL = 'manual',
VISIBILITY_CHANGE = 'visibility_change',
PAGE_LOAD = 'page_load',
}
|
LocalStorage limitations
Do we actually need (and are we allowed) save an entire history of locations of a user? Perhaps 50 records is more than enough? |
Just curious if my proposed solution here is exactly what you're looking for? If not, why not? Your visibility_change and Page_load options miss huge tracts of the journey leaving the resulting distance calculation unreliable (Circles, back-tracking, diversions, stopped etc) See this for more. Cheers Richard |
Thanks for your interest :) I'm trying to understand your solution but I'm not quite getting it yet. As I understand right now the only way you fetch the location is by client JS just like we do, right? What is your SW doing in order to fetch the location? Unfortunately I'm not able to add your page as a PWA since the SW doesn't seem to register.. |
Yes Marc that is the current restriction. What my Polyfill proves is that IF the Browser Vendors OR W3C/IETF implemented the proposed solution, what wouldn't it solve? Why are you not asking W3C/IETF to formalize the TravelManager specification??? Just "Add to homescreen" to register Brotkrumen. Once again Google Lighthouse and the inner sanctum have chosen to dictate rediculous barriers to becoming an official PWA :-( |
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.
The text was updated successfully, but these errors were encountered: