I'm using phonegap to make an app, and when a user doesn't allow a certain permission (GPS for example), then the app doesn't ask again the next time they use that feature and I thought the best I could do is just display a message like this:
Please go to iOS Settings > Privacy > Location Services to enable the app to access your location
But I just noticed that the maps app give this message:
Turn On Location Services to Allow Maps to Determine Your Location
And it has the option of Settings or Cancel. If you click Settings, it takes you right to the location services part of settings so that you can enable it.
My question is, how can I link to that part of settings with a phonegap app?
In iOS >= 8 you can open the application setting panel using:
NSURL *url = [NSURL URLWithString:UIApplicationOpenSettingsURLString];
[[UIApplication sharedApplication] openURL:url];
It's very easy to write a cordova plugin that open that panel from the js layer. To make a portable and stable plugin you should check for the existence of that variable before using it (in iOS < 8).
See the iOS UIApplication documentation for more information.
Ore use an existing cordova settings plugin.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With