Location services not working in webView App

1 min read

If you’re building an mobile app version of your website that makes use of Web View and you realize that the map is not working, then the reason might be some missing configuration inside the mobile app.

You should contact your Mobile App Developer and let them know that the app needs to pass on location service requests to the OS.

On iPhone this might be a more involved process. You can share the following comment from a stackoverflow question with the Developer:

If you are about to load your website inside an app using webView, make sure to add location permission descriptions to the info.plist file. Add NSLocationWhenInUseUsageDescription versus NSLocationAlwaysUsageDescription versus NSLocationUsageDescription as your needs.

For the sake of completeness, on iOS13, you can not get always permission. But this is not the point here and the point is you have to get the required permissions sometime before you need to get the location from GPS or it is not going to work at all.

Location services for Google Maps does work inside webView apps. The App Developer just needs to add the required configuration to make it possible, as these configurations are not something that needs/can be done on the side of the map on the website itself.

Some resources that might help:

https://stackoverflow.com/questions/57130901/getcurrentposition-in-js-does-not-work-on-ios

https://xabaras.medium.com/android-webview-handling-geolocation-permission-request-cc482f3de210