Select to view content in your preferred language

how to use arcgis locate widget with electron?

311
1
03-12-2024 02:21 AM
FM1
by
New Contributor

I'm new with ArcGIS Maps SDK for JavaScript. I'm integrating the map with the locate widget button, following the instruction written in the official tutorial: https://developers.arcgis.com/javascript/latest/sample-code/widgets-locate/

I'm using electron to execute the app (v29.1.1).

With electron, the widget is unable to locate the position due to permissions.

It get the following message:

There was an error. Please check the location permissions on your browser and operating system.

I think that the problem is with electron permission, but I didn't find any solutions for days.

I've already checked the permissions on my browser.

0 Kudos
1 Reply
AndyGup
Esri Regular Contributor

Hi @FM1  the Locate widget uses the browser's native Geolocation API. You can listen for the specific geolocation error messages using the widget's "locate-error" event to confirm the information being returned by the browser. Here's the MDN article that describes those errors: https://developer.mozilla.org/en-US/docs/Web/API/GeolocationPositionError.

Also, in the Electron documentation: "Geolocation support in Electron requires the use of Google Cloud Platform's geolocation webservice." Have you enabled that webservice?

0 Kudos