Windows Phone 8检查位置是否已打开/关闭?

时间:2013-05-22 08:25:48

标签: windows-phone-8 location

我想检查位置服务是否已打开或关闭,因此我可以通知用户他需要打开它以便在地图上查看他的位置。还想检查飞行模式是否打开/关闭以及是否打开/关闭WiFi。有什么建议吗?

1 个答案:

答案 0 :(得分:19)

位置:

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

有关网络内容,请参阅DeviceNetworkInformation class。 E.g。

bool isWifiOn = DeviceNetworkInformation.IsWiFiEnabled;

另请参阅:How to detect network changes for Windows Phone