electron: How to trigger the system geolocation prompt in a MAS (Mac App Store) build on macOS?
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 bug report that matches the one I want to file, without success.
Electron Version
33.2.0
What operating system(s) are you using?
macOS
Operating System Version
15.2
What arch are you using?
arm64 (including Apple Silicon)
Last Known Working Electron version
Expected Behavior
navigator.geolocation.getCurrentPosition hangs indefinitely without returning either a success or an error.
I have already added com.apple.security.personal-information.location in the entitlements, and the system settings show that the application is suppert to access location services (off by default). However, when requesting the location, no system prompt appears to grant or toggle this permission.
A valid GOOGLE_API_KEY is included, and on all other platforms Electron’s geolocation works without issue.
A system prompt should appear asking the user to allow geolocation access, and getCurrentPosition should return position data (or an error if denied).
Actual Behavior
The system prompt never appears, and getCurrentPosition hangs indefinitely.
Testcase Gist URL
No response
Additional Information
- The
GOOGLE_API_KEYis correctly configured since geolocation works as expected on other platforms (Windows, Linux). - System preferences do list the app under Location Services, but no prompt is triggered when the app requests geolocation.
Any help or guidance on how to properly trigger the system geolocation prompt in a MAS build would be greatly appreciated
About this issue
- Original URL
- State: closed
- Created 2 years ago
- Comments: 15 (14 by maintainers)
@mahnunchik I was able to bridge it by writing my own apis for my use case. I’m experimenting with a better approach though. I’ll put it up here once I’m done.
@codebytere is there any existing way to get geolocation on macOS? navigator.geolocation request fail despite adding a Google api key… I’m not sure what’s going on.
@samuelmaddock @codebytere @VerteDinde @ppontes @erickzhao I can not pass Apple review!
Why is there no plan to solve the problem that prevents the app from being released in the App Store?