蓝牙设备名称使用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 !");
  }
}

我不知道如何解决此问题。有什么建议吗?

解决方法

我通过从外围设备发送设备名称来修复它。您可以在外围设备中宣传设备名称。