在我的应用程序中,我必须禁用蓝牙。但如果设备连接到智能手机,我不想这样做。
那我怎么能这样做: if(!areBlueDevicesConnected())) disableBluetooth();
其实我知道如何使用广播接收器,但我不想使用它们(比如How to know whan a speceific bluetooth device is connecting?)。
你有什么想法吗?
感谢。
答案 0 :(得分:0)
您可以查询:
Set<BluetoothDevice> pairedDevices = mBluetoothAdapter.getBondedDevices();
这将返回一组配对设备。 如果这会返回您的设备,那么您可以继续前进以完成您想要实现的任务。