Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to getCurrentPosition via navigator.geolocation in Electron app?

When I try to get the current position

navigator.geolocation.getCurrentPosition(handleCoordinates, handleError, {timeout:10000})

it returns

"Network location provider at 'https://www.googleapis.com/' : Returned error code 400."

Can somebody suggest any possible ways?

like image 287
Vito Avatar asked Sep 04 '25 04:09

Vito


1 Answers

You should configure correct google api key to request google related services in chromium.

https://github.com/electron/electron/blob/master/docs/api/environment-variables.md#google_api_key

https://github.com/electron/electron/issues/9420

like image 168
OJ Kwon Avatar answered Sep 06 '25 01:09

OJ Kwon