Launch Location Setting in Windows Phone
If you create a location based application in Windows Phone, you have to check the location setting in the phone. Is it enabled or not. If it isn’t, usually your app will show a message box that ask the user to enable their phone location first. Well, I think it could be nice if the app can open the location setting so the user don’t have to close your app manually and open the settings, scroll scroll and find the location setting. You can help to make their life easier by this short code:
1 2 3 4 5 6 7 |
MessageBoxResult result = MessageBox.Show("Location is disabled. Do you want to activate it?", "Location", MessageBoxButton.OKCancel); if (result == MessageBoxResult.OK) { await Launcher.LaunchUriAsync(new Uri("ms-settings-location:")); } |
This code will launch location setting and let the user to enable it. Try it! 😀