How to Programatically Check if the Location Services is Turned On or Off in Windows Phone 8 ?

Below is a sample code snippet that demonstrates how to programmatically check if the Location Services is turned On or Off in Windows Phone 8 .

How to Programatically Check if the Location Services is Turned On or Off in Windows Phone 8 ?

Geolocator locationservice = new Geolocator();
if (locationservice.LocationStatus == PositionStatus.Disabled)
{
   MessageBox.Show("The Location Services in Windows Phone 8 is turned Off");
}
%d