What is the best way to retrieve client's geolocation in Vaadin 8?


in my application (Spring boot with Vaadin 8) I have to retrieve the geolocation of the client. What is the best way to do this?

I tried the Vaadin wrapper of the geolocation API (see
). It seems to be not developed further and in the online demo my browser always tells me that “GeoLocation is unsupported by terminal” but this cannot be true since other JavaScripts-Based examples work without problems.

What I’ve also tried is to use Vaadin’s AbstractJavaScriptComponent (like it is explained on
) with my own JavaScript-Code ... navigator.geolocation.getCurrentPosition ... My JavaScript-Code is based on
. While this original example works fine on all of my hardware and with all browsers, I’ve tested, the code does not work properly when it is used in the Vaadin framework: It works on my computer with a Firefox browser; on an Android phone, the promt for permission does not appear and geolocation is shown but very imprecise; on my iPhone, nothing happens - no prompt, no geolocation.

Just to remember, the original code from w3schools works fine in every situation.

My application uses https to avoid security issues. When I place a test.html containing the code example of w3schools underneath my src/main/webapp folder, geolocation is shown precisely in every situation. But code stopps working, when it is wrapped by the Vaadin framework.

What am I doing wrong?

Thank you very much and best regards,

I am having the same problem. Even on an Android phone, the promt for permission does not appear at all and no location is visible. Any update about this thread?