Geolocation.setRNConfiguration() not available?

I’m trying to block a WebView in my app from performing geolocation and throwing a location permission modal on iOS (the webpage in the webview is 3rd party so I can’t control its usage of html5 geolocation).

I thought calling navigator.geolocation.setRNConfiguration({skipPermissionRequests: true})
in Expo might do the trick, but it looks like setRNConfiguration() is unavailable inside Expo.

Are there any other ways to block location permission prompts?

I believe the location permissions for the native app and the web view are different. When someone grants location permission to a native app, they might not want every website they visit within the app to silently get access to their location.

The RN API (navigator.geolocation) is a bit misleading since it looks like the browser API, but it’s really referring to the natively bridged geolocation API and doesn’t affect the browser. Searching online, it looks like this “double prompt” behavior is the default, and to work around it you need to control the code within the web view or somehow intercept its navigator.geolocation accesses.

1 Like

Thanks @ide!

This topic was automatically closed 15 days after the last reply. New replies are no longer allowed.