GeoLocation (GPS) vaadin 14

Hello everyone.
right now i am looking for a method to receive the user’s gps location, i tried with the addon (https://vaadin.com/directory/component/geo-location-addon/api/org/vaadin/elmot/flow/sensors/GeoLocation.html) but it doesn’t seem to work on the versions after 13 of vaadin (on the 13 I tried it works) would you know how to proceed to make it work on the 14 or a better addon that works well on the 14?
meanwhile, thank you

Hi, I see the add on, to get the geolocation uses this line
[navigator.geolocation.watchPosition ]
(https://github.com/elmot/vaadin-geo-location/blob/13deca766a53d22ad24f12fa74058529e59ef0af/vaadin-geo-location.html#L65) You can execute that line of Javascript in Vaadin.

See this [example]
(https://developer.mozilla.org/en-US/docs/Web/API/Geolocation/watchPosition) to understand how work in js, and [wrap with Vaadin]
(https://vaadin.com/docs/v14/flow/element-api/client-server-rpc.html)

Is the component fixed to work with Vaadin 14 now? or atleast anyone implemented the workaround suggested by @Johny above? HTML5 features are pretty much standard these days and more significant for PWAs… So how to get a stable maintainable application with Vaadin? Sorry guys if I sound a bit bummed… But an awesome enginered framework like Vaadin must provide plugins (addons?) with more documentation/ example codes to help dummies… I think that is a sure approach to explosive adoption and developer base.

There is a ticket about it: https://github.com/elmot/vaadin-geo-location-flow/issues/2

And I made a pull request to upgrade the plugin to Vaadin 14.

Jean-Christophe Gueriaud:
There is a ticket about it: https://github.com/elmot/vaadin-geo-location-flow/issues/2

And I made a pull request to upgrade the plugin to Vaadin 14.

fantastic i wait for you fork

Jean-Christophe Gueriaud:
There is a ticket about it: https://github.com/elmot/vaadin-geo-location-flow/issues/2

And I made a pull request to upgrade the plugin to Vaadin 14.

hoping wont take long… need at least very simple functions such as accessing lat-long values.

I published a Vaadin 14 version of the component: https://vaadin.com/directory/component/geo-location-addon---vaadin-14

Here you can find the original issue: https://github.com/elmot/vaadin-geo-location-flow/issues/2

Thanks @Jean… I was able to resolve the dependency now. I have even placed the code sample into my page and can see <vaadin-geo-location> tag added to the correct layout. How do I request for user permission// trigger watching the location?

The request for user permission should be done automatically by the browser if you never say No before and if you domain is https.

It’s forbidden by default if your server is not in https.

localhost is an exception in Chrome or the new MS Edge and it should be fine.

For Safari I don’t have any request for localhost.

For FF, it seems blocked also, because of non-https.

Good point @Jean. I have placed the @PWA annotation on my app, so for service worker to work, I am making production build… even for developer testing (I use CI Spring Boot jar method to run the server). However, I still use localhost url and Chrome browser to test. I am still not able to see the browser location request for the website.

I understand you mentioned, the request is forbidden by default at server side. Is there any setting in vaadin configuration, which I can enable for testing in dev environment?

Perhaps you can try to build the component and try the demo.

You can get it on github here https://github.com/jcgueriaud1/vaadin-geo-location-flow

git clone https://github.com/jcgueriaud1/vaadin-geo-location-flow.git
cd vaadin-geo-location-flow
mvn clean package
mvn -Pdemo jetty:run

And open your browser http://localhost:8080

On Chrome you have an icon on the right of the address bar to toggle the permission.