Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/android/189.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Java 如何在安卓系统中断开已配对蓝牙耳机的连接,而不是取消配对_Java_Android_Bluetooth_Sony_Headphones - Fatal编程技术网

Java 如何在安卓系统中断开已配对蓝牙耳机的连接,而不是取消配对

Java 如何在安卓系统中断开已配对蓝牙耳机的连接,而不是取消配对,java,android,bluetooth,sony,headphones,Java,Android,Bluetooth,Sony,Headphones,我传递蓝牙设备,即我从中获得的索尼WH-1000XM3:Set pairedDevices=bluetoothAdapter.getBondedDevices() 耳机连接线程类尝试与蓝牙耳机建立连接 连接部件工作正常,即已连接成对的耳机,并且可以向其传输数据 要断开连接,我调用close(),更新BluetoothSocket(见下文)的状态,但是耳机没有断开连接 socket.isConnected()=false, headphone.getBondState()=12 债券国12:

我传递蓝牙设备,即我从中获得的索尼WH-1000XM3:
Set pairedDevices=bluetoothAdapter.getBondedDevices()

耳机连接线程类尝试与蓝牙耳机建立连接

连接部件工作正常,即已连接成对的耳机,并且可以向其传输数据

要断开连接,我调用
close()
,更新
BluetoothSocket
(见下文)的状态,但是耳机没有断开连接

socket.isConnected()=false, headphone.getBondState()=12
债券国12:



从您链接的文档中:

Being bonded (paired) with a remote device does not necessarily mean the device is currently connected. It just means that the pending procedure was completed at some earlier time, and the link key is still stored locally, ready to use on the next connection.
因此,如果您的代码输出
socket.isConnected=false
bondedState=12
,则表示它已配对并断开连接

socket.isConnected()=false, headphone.getBondState()=12
您的代码中没有错误