2016-11-14 43 views

回答

0

您可以使用this文档和MobileBroadbandRadioState枚举了UWP的应用程序,但它保留用于移动运营商,你不能在应用程序中使用它,你要上传到商店。

首先,你必须编辑Package.appxmanifest文件,并添加阻容组件命名空间

<Package 
xmlns="http://schemas.microsoft.com/appx/manifest/foundation/windows10" 
xmlns:mp="http://schemas.microsoft.com/appx/2014/phone/manifest" 
xmlns:uap="http://schemas.microsoft.com/appx/manifest/uap/windows10" 
xmlns:rescap="http://schemas.microsoft.com/appx/manifest/foundation/windows10/restrictedcapabilities" 
IgnorableNamespaces="uap mp wincap rescap"> 

,并添加新的功能

<rescap:Capability Name="cellularDeviceIdentity"/> 

在你的项目中添加该代码来检查飞行模式状态

var ids = MobileBroadbandAccount.AvailableNetworkAccountIds; 
var account = MobileBroadbandAccount.CreateFromNetworkAccountId(ids[0]); 

Debug.WriteLine(account.CurrentDeviceInformation.CurrentRadioState); 
相关问题