electron: [Bug]: navigator.geolocation.getCurrentPosition isn't working (GeolocationPositionError:Timeout expired)
Preflight Checklist
- I have read the Contributing Guidelines for this project.
- I agree to follow the Code of Conduct that this project adheres to.
- I have searched the issue tracker for a feature request that matches the one I want to file, without success.
Electron Version
12.0.2
What operating system are you using?
macOS
Operating System Version
macOS Big Sur 11.2.3
What arch are you using?
x64
Last Known Working Electron version
10.4.2
Expected Behavior
Calling of navigator.geolocation.getCurrentPosition()
is returning coordinates (latitude and longitude) and not disabling provided access to Location Services in case of any platform (macOS / Windows / Linux).
Actual Behavior
Calling of navigator.geolocation.getCurrentPosition()
is disabling provided access to Location Services (macOS: System settings -> Security & Privacy -> Privacy -> Location Services). Looks like it’s a reason why the app is getting as response: GeolocationPositionError (code: 3, message: Timeout expired)
. Geolocation isn’t working in case of any platform (macOS / Windows / Linux) since Electron 11.0.0.
Testcase Gist URL
https://gist.github.com/3e1667de4e59b5ddd9caf8b5c5711515
Before using gist, please be sure, that:
- you have
GOOGLE_API_KEY
GOOGLE_API_KEY
is having right set-up:
- isn’t having any application restriction
- restricted by Geolocation API
- linked to billing account, which is validated by Google
GOOGLE_API_KEY
added to:main.js, line 3
of the gist
About this issue
- Original URL
- State: closed
- Created 3 years ago
- Reactions: 8
- Comments: 15 (4 by maintainers)
Any news ? I found out that it work if you execute
navigator.geolocation.getCurrentPosition
and then toggle the location Service for your app in the System preferencies. If I retrigger after that it doesn’t.@MarshallOfSound Do you have any insight on this? Electron latest is 15. It is a hard hit to go back to 10