How to open Device Setting in Xamarin.Forms(Android, iOS, Windows 8.1+) Application?

I am working on an application which requires user current location. Application is working if Location Service is on, but if location service is disabled then I want to prompt user to start location service on a Display Alert and on Click i want to open Device settings. Any Suggestions how to do that?

Best Answers


  • JohnHardmanJohnHardman GBUniversity mod
    edited March 2017


    On Android:

    StartActivity(new Intent(Android.Provider.Settings.ActionSettings));

    On iOS:

    UIApplication.SharedApplication.OpenUrl(new NSUrl(UIKit.UIApplication.OpenSettingsUrlString));

    On UWP:

    await Windows.System.Launcher.LaunchUriAsync(new Uri("ms-settings:privacy-location"));

    Sorry, haven't done it for Win 8.1

  • Sumit.SharmaSumit.Sharma INMember ✭✭

    Hey @JohnHardman Thanks for the reply, I am sorry I didn't specify in my question, But I was looking for a way to open device setting from PCL project.

    Any Suggestion??

  • Sumit.SharmaSumit.Sharma INMember ✭✭
    edited March 2017

    I have Implemented for Android and getting Error:

    The name 'StartActivity' does not exist in the current context (project_name).Droid\OpenDeviceSettings.cs

    Can you guys share some Sample Code for this?
    @JamesLavery @JohnHardman

Sign In or Register to comment.