检测是否连接了蓝牙设备(android)

时间:2015-03-27 13:15:47

标签: android bluetooth

在我的应用程序中,我必须禁用蓝牙。但如果设备连接到智能手机,我不想这样做。

那我怎么能这样做: if(!areBlueDevicesConnected())) disableBluetooth();

其实我知道如何使用广播接收器,但我不想使用它们(比如How to know whan a speceific bluetooth device is connecting?)。

你有什么想法吗?

感谢。

1 个答案:

答案 0 :(得分:0)

您可以查询:

Set<BluetoothDevice> pairedDevices = mBluetoothAdapter.getBondedDevices();

这将返回一组配对设备。 如果这会返回您的设备,那么您可以继续前进以完成您想要实现的任务。