如何解决蓝牙设备名称使用Xamarin形式的Bluetooth LE返回null
我正在尝试在Xamarin表单应用程序中实现Bluetooth LE。但是发现蓝牙设备后,我只能访问蓝牙设备的地址。我无法找到蓝牙设备的名称。我尝试了各种解决方案,但没有一个起作用。这是我的代码
private async void btnScan_Clicked(object sender,EventArgs e) {
try {
deviceList.Clear();
adapter.ScanMode = ScanMode.LowLatency;
adapter.Devicediscovered += (s,a) => {
deviceList.Add(a.Device);
};
//We have to test if the device is scanning
if (!ble.Adapter.IsScanning) {
await adapter.StartScanningForDevicesAsync();
}
} catch (Exception ex) {
displayAlert("Notice",ex.Message.ToString(),"Error !");
}
}
我不知道如何解决此问题。有什么建议吗?
解决方法
我通过从外围设备发送设备名称来修复它。您可以在外围设备中宣传设备名称。
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。