加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 综合聚焦 > 服务器 > Windows > 正文

windows-phone-8 – Windows Phone 8检查位置是否打开/关闭?

发布时间:2020-12-14 02:14:27 所属栏目:Windows 来源:网络整理
导读:我想检查位置服务是否已打开或关闭,因此我可以通知用户他需要打开它以便在地图上查看他的位置.还想检查飞行模式是否打开/关闭以及是否打开/关闭WiFi.有什么建议? 解决方法 位置: Geolocator locator = new Geolocator();if (locator.LocationStatus == Pos
我想检查位置服务是否已打开或关闭,因此我可以通知用户他需要打开它以便在地图上查看他的位置.还想检查飞行模式是否打开/关闭以及是否打开/关闭WiFi.有什么建议?

解决方法

位置:

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

有关网络内容,请参阅DeviceNetworkInformation class.例如

bool isWifiOn = DeviceNetworkInformation.IsWiFiEnabled;

另见:How to detect network changes for Windows Phone

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读