Xamarin.forms 适用于iOS和Android的蓝牙扫描仪(Xamarin表单)

Xamarin.forms 适用于iOS和Android的蓝牙扫描仪(Xamarin表单),xamarin.forms,xamarin.android,bluetooth,xamarin.ios,bluetooth-lowenergy,Xamarin.forms,Xamarin.android,Bluetooth,Xamarin.ios,Bluetooth Lowenergy,我们正在实施Xamarin表单应用程序,它可以在iOS和Android上运行。应用程序需要有条形码扫描功能,使用摄像头和蓝牙设备。虽然摄像头部分已经完成,但我们仍在寻找蓝牙设备集成。我们试过Socket Scanner,它在iOS上运行得很好,但在Android上却不行。是否有其他蓝牙扫描仪可以在iOS和Android上工作?如果不是,我们应该分别为iOS和Android安装蓝牙。请提供SDK和硬件的链接(如果可用) 谢谢 对于Xamarin中的蓝牙,您可以使用Nuget提供的pluginplu

我们正在实施Xamarin表单应用程序,它可以在iOS和Android上运行。应用程序需要有条形码扫描功能,使用摄像头和蓝牙设备。虽然摄像头部分已经完成,但我们仍在寻找蓝牙设备集成。我们试过Socket Scanner,它在iOS上运行得很好,但在Android上却不行。是否有其他蓝牙扫描仪可以在iOS和Android上工作?如果不是,我们应该分别为iOS和Android安装蓝牙。请提供SDK和硬件的链接(如果可用)


谢谢

对于Xamarin中的蓝牙,您可以使用Nuget提供的pluginplugin.BLE

首先,不要忘记为特定平台添加权限

在Android中 将以下行添加到AndroidManifest.xml

<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-permission android:name="android.permission.BLUETOOTH" />
<uses-permission android:name="android.permission.BLUETOOTH_ADMIN" />

有关更多详细信息和用法,您可以使用此插件检查

我们可以连接到任何类型的蓝牙条形码扫描仪吗?此外,我们可以在我们的应用程序上写入/显示结果吗?可以检查ble状态;发现设备;连接/断开;发现服务;发现特征;参见特征细节;读/写和注册特性通知;
<key>UIBackgroundModes</key>
<array>
    <!--for connecting to devices (client)-->
    <string>bluetooth-central</string>

    <!--for server configurations if needed-->
    <string>bluetooth-peripheral</string>
</array>

<!--Description of the Bluetooth request message (required on iOS 10, deprecated)-->
<key>NSBluetoothPeripheralUsageDescription</key>
<string>App want to access the bluetooth</string>

<!--Description of the Bluetooth request message (required on iOS 13)-->
<key>NSBluetoothAlwaysUsageDescription</key>
<string>App want to access the bluetooth</string>
var ble = CrossBluetoothLE.Current;
var state = ble.State;
var adapter = CrossBluetoothLE.Current.Adapter;