Forum Xamarin Xamarin.Forms

IsProviderEnabled always return true either Location service is enabled or disabled

I am working in xamarin forms. I need to check the location service is enabled or not for android. I wrote the following code :

LocationManager locMgr = GetSystemService(LocationService) as LocationManager;
string Provider = LocationManager.GpsProvider;
var islocationEnabled = locMgr.IsProviderEnabled(Provider);
But I am always getting true value either location service is enabled or not. How I can get the correct value?

Sign In or Register to comment.