我如何知道 Windows phone 8 上是否启用了蓝牙? [英] How can I know bluetooth is enabled or not on Windows phone 8?

查看:20
本文介绍了我如何知道 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

祝你好运(:

这篇关于我如何知道 Windows phone 8 上是否启用了蓝牙?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆