本文介绍了[UWP] [C#]无法使用GetRadiosAsync找到蓝牙无线电的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
大家好b
我正在尝试开发应用程序可以控制蓝牙模块状态。使用以下代码。
var result = await Radio.RequestAccessAsync();
IReadOnlyList< Radio> radios = await Radio.GetRadiosAsync();
Radio BluetoothRadio = radios.FirstOrDefault(radio => radio.Kind == RadioKind.Bluetooth);
等待BluetoothRadio.SetStateAsync(RadioState.On);
我还在应用清单中包含无线电功能,如下所示。
< DeviceCapability Name =" radios" />
但是我遇到了挑战蓝牙状态已关闭,应用程序无法打开它。
我调试了代码并看到蓝牙模块状态何时关闭它无法被
捕获的 Radio.GetRadiosAsync()&NBSP;
你能帮我弄清楚这个问题是如何解决的吗?
问候,
Reza
$
解决方案
Hi everyone
I am trying to develop an app can take control of the Bluetooth module state. using following codes.
var result = await Radio.RequestAccessAsync(); IReadOnlyList<Radio> radios = await Radio.GetRadiosAsync(); Radio BluetoothRadio = radios.FirstOrDefault(radio => radio.Kind == RadioKind.Bluetooth); await BluetoothRadio.SetStateAsync(RadioState.On);
I also include Radio capabilities in the app manifest as follow.
<DeviceCapability Name ="radios"/>
But I have a challenge when the Bluetooth state is off, which the app can't turn it on.
I debugged the code and saw when the Bluetooth module state is off it can't be caught byRadio.GetRadiosAsync()
Can you help me figure out how I this issue can be solved?
Regards,
Reza
解决方案
这篇关于[UWP] [C#]无法使用GetRadiosAsync找到蓝牙无线电的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!