2016-11-14 90 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); 
相關問題