Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Windows Phone 8 Check if location is turned on/off?

I want to check if the location service is turned on or off, so I can inform the user that he needs to turn it on in order to see his location on the map. Also want to check if airplane mode is on/off and if WiFi is turned on/off. Any suggestions?

like image 916
Rares Felecan Avatar asked Nov 30 '22 21:11

Rares Felecan


1 Answers

For location:

Geolocator locator = new Geolocator();
if (locator.LocationStatus == PositionStatus.Disabled)
{
    // Location is turned off
}

For network stuff, see DeviceNetworkInformation class. E.g.

bool isWifiOn = DeviceNetworkInformation.IsWiFiEnabled;

See also: How to detect network changes for Windows Phone

like image 75
anderZubi Avatar answered Dec 17 '22 08:12

anderZubi