Forum Xamarin.Forms

Identify GPS is enabled or not

KarthikRamKarthikRam USMember ✭✭

Dear Team,

I would like to place a prompt where it identifies if user has disabled GPS or not. If GPS is enabled, I would like to open a page. If its disbaled, I would like to show a prompt to tell user to enable GPS and then open. Please let me know how to acheive the same


  • AlessandroCaliaroAlessandroCaliaro ITMember ✭✭✭✭✭

    I think you have to do this with DependencyService.

    For Example, this code should test if GPS is enabled, otherwise open the panel to enable it

    (For Android)

    public class Gps : IGps
        public Gps ()
        public void View(){
            LocationManager locationManager = (LocationManager)Forms.Context.GetSystemService(Context.LocationService);
            if (locationManager.IsProviderEnabled(LocationManager.GpsProvider) == false)
                Intent gpsSettingIntent = new Intent(Settings.ActionLocationSourceSettings);
  • AlessandroCaliaroAlessandroCaliaro ITMember ✭✭✭✭✭

    for iOS I think it's not possible...

  • jackfidojackfido USMember

    I suppose because iOS has a GPS and has not providers like Android, I mean, in android providers can select if their devices has or not GPS

  • JohnHardmanJohnHardman GBUniversity admin

    @KarthikRam - I know this is an old thread, but in case you haven't implemented this yet - take a look at - the Location permission is probably what you want to check.

  • RPrashanthRPrashanth Member ✭✭

    Hi @AlessandroCaliaro

    your solution is navigating to device settings -> location settings to turn on .
    But what i want is GPS should be turned on in the device like google pay app is doing please go through the image attached after clicking ok GPS setting
    is turning on , correct me if i'm wrong.
    and please give me some solution to turn on GPS setting if you have.


Sign In or Register to comment.