How can I know bluetooth is enabled or not on Windows phone 8?

后端 未结 1 1546
没有蜡笔的小新
没有蜡笔的小新 2021-01-15 14:53

I can use ConnectionSettingsTask to access Bluetooth settings, but how can I know whether Bluetooth\'s enabled after the task is completed?

I checked windows phone m

相关标签:
1条回答
  • 2021-01-15 15:44

    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;
                }
               
            }          
        }
    

    An error 0x8007048F indicated if Bluetooth is turned off. This is working for me without any problems. For more information visit this link

    Good luck mate (:

    0 讨论(0)
提交回复
热议问题