Android BLE蓝牙开发
文章平均质量分 62
szzyjsxyzwy
这个作者很懒,什么都没留下…
展开
-
Android BLE (二)---连接
Android BLE (二)—连接1、连接前准备首先需要在扫描设备的时候拿到BluetoothDevice对象,Context(在Activity或者Application中获取到)和 连接回调接口BluetoothGattCallback(需要自己定义和编写代码)BluetoothGattCallback接口写法private BluetoothGattCallback gattCallback = new BluetoothGattCallback() { @Override原创 2022-05-07 00:09:01 · 2459 阅读 · 1 评论 -
Android BLE蓝牙开发(一)—扫描并显示结果
Android BLE蓝牙开发(一)—扫描并显示结果一、获取BluetoothAdapter实例BLe蓝牙获取BluetoothAdapter实例不同与经典蓝牙一样,首先得通过系统服务getSystemService(BLUETOOTH_SERVICE)获取BluetoothManager的实例,然后再通过BluetoothManager的getAdapter方法获取BluetoothAdapter实例。代码: private BluetoothAdapter mBluetoothAdapter;原创 2021-07-18 13:48:02 · 1373 阅读 · 0 评论