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

时间:2018-03-21 11:34:25   收藏:0   阅读:1950

 

随着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;
}

  •  

 

 

 

 //以前的草稿,项目完成了,先发布,补充待期。

 

 

评论(0
© 2014 mamicode.com 版权所有 京ICP备13008772号-2  联系我们:gaon5@hotmail.com
迷上了代码!