我如何知道 Windows phone 8 上是否启用了蓝牙?

编程入门 行业动态 更新时间:2024-10-28 10:21:31
本文介绍了我如何知道 Windows phone 8 上是否启用了蓝牙?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

限时送ChatGPT账号..

我可以使用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/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屋!

更多推荐

[db:关键词]

本文发布于:2023-04-25 14:04:34,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1117785.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:蓝牙   Windows   phone

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!