Permission for Geolocation service

iOS 13.4.1
NSB/Appstudio 8.1.0.3

I’m getting the following error on my web app:
“Origin does not have permission to use Geolocation service”
when trying to use navigator.geolocation.watchPosition

I’ve turned Location services on - is there something specific I need to do for my app?

You have to add some settings to your config.xml file.

In the old days, geolocation in cordova apps was handled via a plugin. With HTML5, geolocation is now handled by the browser. But, because it’s available doesn’t mean you can access it. In order to access the users location data you have to ask for permission and this is kinda handled automatically.

Now, the geolocation plugin no longer handles any real geolocation services but it does handle the permission so you have to include it in your project and you have to tell the user why you want access to their location.

<plugin name="cordova-plugin-geolocation" spec="4.0.2">
  <variable name="GEOLOCATION_USAGE_DESCRIPTION" value="Tell the user why you want access to their location." />
</plugin>

This is a web app - not a cordova app - I’m not sure what you mean.

Sorry, I keep forgetting that some people are doing PWA’s.

Make sure you’re only trying to use geolocation over httpS. Chrome, Firefox and Safari no longer support the API over plain ol http. There’s a deeper dive in this link.

A great tutorial on using geolocation in a PWA is here.

My PWA is hosted by Volt. Does this ensure https?

Yes, Volt is https.