iOS plugin for sending user to Settings->Privacy->Location Services?

An app that is using location must also account for a case where location services are disabled.

I am looking for a way to guide and send the user directly to the Settings->Privacy->Location Services system page on iOS:

There are a number of native apps from the App Store that can and already do this.

Any Cordova plugin that does the job on iOS? is able to do that for Android with the cordova.plugins.diagnostic.switchToLocationSettings() call but not for iOS.

Linking to related discussion over at cordova-diagnostic-plugin’s repo:

I got around to updating cordova-plugin-request-location-accuracy - v2.0.0 now enables a direct location request to be made which triggers the native iOS dialog to directly open the Privacy page in the Settings app where the switch for Location Services is located.

1 Like

can anyone have solution for this?

It was possible earlier, but you can’t submit your app now in AppStore without getting your app rejected during review. Please check here

It is not programmatically possible to switch Location Services ON or to directly open the Location Services page in the Settings app.

Your best choice would be to open just ‘settings’ when required, using the diagnostics plugin and use the method switchToSettings() as described here

Please note that you can use the same diagnostics plugin to open location services settings in Android and Windows 10 UWP using switchToLocationSettings() but not in iOS.

thank you for your reply.
yes, i am able to open location setting in android using diagnostics plugin. but not working in ios. is it not possible to open location services in ios? i am currently using ionic5.

I am not sure but as answered above by dpa99c1, you may use this plugin to show a native iOS system dialog that will ask to open it for you. It seems the plugin can be implemented by ionic native plugin location accuracy.
Also, please make note that as mentioned in the documentation, there is a scenario in which this plugin fails :

If, upon successfully showing the native dialog, the user presses “Cancel” instead of “Settings”, any subsequent requests via this plugin will not show the dialog again. Ever! This is because iOS assumes that if the user pressed “Cancel”, they don’t want your app to use their location, so iOS prevents you from asking them again to switch on Location Services.
There’s no way to tell which button the user pressed in the native dialog or whether “Cancel” was pressed and the dialog is not being shown.

So you have to handle the exceptions in your app considering this scenario. If the user presses ‘Cancel’ which leads to canRequest() function of this plugin to return false, then you don’t have any choice to open any system dialog, and will then have to return to the same state as you were before implementing this plugin.

thanks. i have already tried this location accuracy plugin. and yes in ios, it is not showing dialog once cancel button is clicked. i think i have only one way for ios. i have to switch to setting page only as we are not able to redirect to location setting page.

Yes, that would be a much better approach.