【问题标题】:Android: Seperate Bluetooth Classic Scan from Low Energy Scan, or distinguish Classic Devices from Low Energy DevicesAndroid:将蓝牙经典扫描与低功耗扫描分开,或区分经典设备与低功耗设备
【发布时间】:2014-09-29 12:15:49
【问题描述】:

我正在开发一个实现蓝牙的安卓应用。 蓝牙扫描,一切运行良好(我在这里参考了 android 蓝牙聊天代码示例:(https://android.googlesource.com/platform/development/+/25b6aed7b2e01ce7bdc0dfa1a79eaf009ad178fe/samples/BluetoothChat),但是当蓝牙扫描运行时,我的设备也会找到低功耗蓝牙设备。 我已经用 Galaxy Nexus (Android KitKat) 和 Nexus 7 (2013) (也是 KitKat) 进行了尝试。

如何防止蓝牙适配器在使用该功能时发现蓝牙 LE 设备

mBluetoothAdapter.startDiscovery();

官方的低功耗蓝牙示例 (http://developer.android.com/samples/BluetoothLeGatt/index.html) 说,对于低功耗扫描,您必须使用

mBluetoothAdapter.startLEScan();

作为一种解决方法,是否可以将发现的蓝牙经典设备与发现的蓝牙低功耗设备区分开来?

【问题讨论】:

    标签: android bluetooth bluetooth-lowenergy android-4.4-kitkat connectivity


    【解决方案1】:

    你可以使用函数

    getType()
    

    每个

    BluetoothDevice
    

    见:http://developer.android.com/reference/android/bluetooth/BluetoothDevice.html

    并搜索所有属于 DEVICE_TYPE_CLASSIC 的设备

    【讨论】:

    • 完美!非常感谢。
    猜你喜欢
    • 2014-04-23
    • 1970-01-01
    • 2013-11-26
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多