C# 移动开发(Xamarin.Form) Plugin.BLE 蓝牙连接


 

随着Xamarin.Form项目接近尾声,仔细一算才发现过来大半年时间了。

期间除了刚开始有闲情写写,现在总算有空来总结一下了。

来先说 Plugin.BLE (https://github.com/xabre/xamarin-bluetooth-le),在NuGet里搜索 Bluetooth ,Plugin.BLE是下载最多的Xamarin.Form可用的库,有16.3K(1.63万)人下载(2017-11-23)。

几乎可用库都试过

  • 调用

 Plugin.BLE用法有两种,一种直接调用,代码来自Plugin.BLE的开源项目


  var ble = CrossBluetoothLE.Current;

 //另一种是注入MvvmCross服务

  var ble = Mvx.Resolve<IBluetoothLE>();
var adapter = Mvx.Resolve<IAdapter>();

//或者
 MyViewModel(IBluetoothLE ble, IAdapter adapter)
{
 this.ble = ble; this.adapter = adapter;
}

  •  

 

 

 

 //以前的草稿,项目完成了,先发布,不再更新。

 

 


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM