对于Android 的英文帮助文档,总是看了记不住,远不如对中文资料那么印象深,所以下面的叙述都是对Android 帮助文档Bluetooth 的翻译
一、Bluetooth Android 平台包含了对Bluetooth 协议栈的支持,允许机器通过 Bluetooth 设备进行无线数据交换
应用框架通过 Android Bluetooth API 访问 Bluetooth 功能模块
这些 API 能让应用无线连接其他 Bluetooth 设备,实现点对点和多点之间的通信
运用蓝牙 API,Android 应用程序可以完成如下操作: 1、扫描其他 Bluetooth 设备
2、查询配对Bluetooth 设备的本地 Bluetooth 适配器
3、建立 RFCOMM 通道
4、通过服务探索连接到其他设备
5、与其他设备进行数据传输
6、管理多个连接 二、The Basics 本文描述如何使用 Android Bluetooth APIs 完成 Bluetooth 通讯的4 个必要任务:设置Bluetooth,搜寻本地配对或者可用的Bluetooth 设备,连接 Bluetooth 设备,与 Bluetooth设备进行数据传输
所有可用的Bluetooth APIs 都包含在 android
bluetooth 包中
下面是建立 Bluetooth 连接需要用到的类和接口的总结: 1、BluetoothAdapter 描述本地 Bluetooth 适配器(Bluetooth 接收器)
BluetoothAdapter 是所有 Bluetooth 相关活动的入口
运用 BluetoothAdapter 可以发现其他 Bluetooth 设备,查询连接(或配对)的设备列表,用已知 MAC 地址实例化一个 BluetoothDevice 对象,创建一个Blueto