我如何知道 Windows phone 8 上是否启用了蓝牙?
我可以使用ConnectionSettingsTask访问蓝牙设置,但是任务完成后如何知道蓝牙是否开启?
I can use ConnectionSettingsTask to access Bluetooth settings, but how can I know whether Bluetooth's enabled after the task is completed?
我查看了 windows phone 市场,发现有些应用程序可以做到这一点,例如:
I checked windows phone marketplace, found that some app can do that, for example:
http://www.windowsphone.com/en-us/store/app/quick-settings/2a2cbaa7-6d75-420c-ae14-2339618da43e
谢谢!
这只是一个建议,这就是我正在使用的,我相信有更好的方法
It's just a suggestion,this is what i am using, i am sure that there are better ways
private async void FindPaired()
{
Windows.Networking.Proximity.PeerFinder.Start();
try
{
var peers = await Windows.Networking.Proximity.PeerFinder.FindAllPeersAsync();
bth = true; //boolean variable
}
catch (Exception ex)
{
if ((uint)ex.HResult == 0x8007048F)
{
bth = false;
}
}
}
错误 0x8007048F
指示蓝牙是否关闭.这对我有用,没有任何问题.有关详细信息访问此链接
An error 0x8007048F
indicated if Bluetooth is turned off. This is working for me without any problems. For more information visit this link
祝你好运(: