【问题标题】:Android Bluetooth LE and Classic Bluetooth APIAndroid 蓝牙 LE 和经典蓝牙 API
【发布时间】:2013-10-25 18:38:54
【问题描述】:

我正在编写一个能够连接到蓝牙 LE 设备和旧的经典蓝牙设备的应用程序。 在 Android OS 4.3 中,LE 和 Classic 使用了不同的 API。

如何自动检测到我连接的设备是蓝牙 LE 设备还是经典蓝牙设备,以便我可以选择正确的 API 进行连接?

【问题讨论】:

    标签: android bluetooth android-4.3-jelly-bean


    【解决方案1】:

    您可能需要扫描设备两次,对于 BLE 设备使用:BluetoothAdapter.startLeScan,对于经典蓝牙设备使用:BluetoothAdapter.startDiscovery。

    【讨论】:

    • 我可以先配对设备,然后使用 BluetoothAdapter.getBondedDevices() 获取设备列表以供选择。获取正确的设备名称并启动相应的服务(BLE 或经典)
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2017-10-26
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多