【发布时间】:2019-09-03 21:53:48
【问题描述】:
我正在尝试为 Android 和 ISO 开发一个 xamarin 表单应用程序。
我正在使用这个金块包https://github.com/xabre/xamarin-bluetooth-le
我已将此添加到 AndroidManiFest.xml
<uses-permission android:name="android.permission.BLUETOOTH"/>
<uses-permission android:name="android.permission.BLUETOOTH_ADMIN"/>
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<uses-feature android:name="android.hardware.bluetooth_le" android:required="true"/>
然后我将 IBluetoothLE 接口设置为 ble
IBluetoothLE ble;
并在我的构造函数中将其设置为 CrossBluetoothLE.Current;
ble = CrossBluetoothLE.Current;
当我尝试通过写入来获取我的 BLE 设备的状态时
Var State = ble.state;
结果显示不可用。
我该怎么办?
【问题讨论】:
-
你的蓝牙连接到那个时候了吗?有关于如何Get the bluetooth status 的示例。您可以下载示例并检查代码。
标签: c# xamarin.forms bluetooth-lowenergy