Forum Xamarin Xamarin.Android

Check if Location Service is running

oliveiravitor3oliveiravitor3 BRMember ✭✭
edited July 2017 in Xamarin.Android

Is there any way to check if a Location Service is running?

I created my service like

public LocationServiceTest
    public void StartLocationUpdates()
        Criteria criteriaForGPSService = new Criteria();
        var locationProvider = LocationManager.GetBestProvider(criteriaForGPSService, true);
        LocationManager.RequestLocationUpdates(locationProvider, 0, 0, this);

But i couldn't find way to check if this service is running, there's an example here, but it doesn't work for locations.


  • BillyMartinBillyMartin USMember ✭✭✭

    @oliveiravitor3 , did you find a solution to check if GPS is turned on? I always thought that the locator plugin would test for it, but it doesn't. My app crashes if it has GPS permission but GPS is turned off.

  • oliveiravitor3oliveiravitor3 BRMember ✭✭

    Hi @BillyMartin
    I couldn't find a way. What I did instead is force my service off, and turn on again.

    And its only for Android.

Sign In or Register to comment.