简体   繁体   English

我从来没有从BluetoothSocket.connect()中脱身

[英]I never get out from BluetoothSocket.connect()

Any idea what might be causing the issue? 任何想法可能是导致问题的原因吗? I execute the connect() function and no further code is executed. 我执行connect()函数,不再执行任何代码。

CODE: 码:

 void openBT() throws IOException
{
    UUID uuid = UUID.fromString("00001101-0000-1000-8000-00805F9B34FB"); //Standard SerialPortService ID
    mmSocket = mmDevice.createRfcommSocketToServiceRecord(uuid);
    mmSocket.connect();
    mmOutputStream = mmSocket.getOutputStream();
    mmInputStream = mmSocket.getInputStream();

    beginListenForData();

    myLabel.setText("Bluetooth Opened");
}

Logcat: Logcat:

05-01 20:10:00.569  24445-24445/bluetooth.example.com.bluetoothserial D/OpenGLRenderer﹕ Enabling debug mode 0
05-01 20:10:07.606  24445-24445/bluetooth.example.com.bluetoothserial D/BluetoothUtils﹕ isSocketAllowedBySecurityPolicy start : device null
05-01 20:10:07.606  24445-24445/bluetooth.example.com.bluetoothserial W/BluetoothAdapter﹕ getBluetoothService() called with no BluetoothManagerCallback
05-01 20:10:07.626  24445-24445/bluetooth.example.com.bluetoothserial D/BluetoothSocket﹕ connect(), SocketState: INIT, mPfd: {ParcelFileDescriptor: FileDescriptor[61]}
05-01 20:10:08.086  24445-24445/bluetooth.example.com.bluetoothserial I/Choreographer﹕ Skipped 31 frames!  The application may be doing too much work on its main thread.

Any idea? 任何想法?

I wasn't having the right UUID, I solved it by obtaining the right UUID and then replacing it in the code. 我没有正确的UUID,我通过获取正确的UUID并将其替换为代码来解决它。

How to obtain UUID: 如何获取UUID:

ParcelUuid[] list = mmDevice.getUuids();

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 BluetoothSocket.connect()抛出IOException - BluetoothSocket.connect() throws IOException BluetoothSocket.connect 不会抛出异常,但我没有连接 - BluetoothSocket.connect doesn't throw an exception, but I'm not connected bluetoothsocket.connect()在第二次运行时引发异常 - bluetoothsocket.connect() throws exception in the second run BluetoothSocket.connect()引发异常“读取失败” - BluetoothSocket.connect() throwing exception “read failed” 在Android的蓝牙中,BluetoothSocket.connect是否调用SDP以获取新频道 - In Android's bluetooth, does BluetoothSocket.connect invoke SDP to get fresh channel Android AlertDialog 直到 bluetoothsocket.connect() 之后才会显示 - Android AlertDialog won't show until after bluetoothsocket.connect() 带有Android 9的Samsung S9上BluetoothSocket.connect()失败 - BluetoothSocket.connect() fails on Samsung S9 with Android 9 为什么在Toast.makeText()。show()之前调用BluetoothSocket.connect()? - Why is BluetoothSocket.connect() called before Toast.makeText().show()? 应用程序挂在BluetoothSocket.connect()上,挂在InputStream.read()上,connect()后无法断开连接 - Application hangs on BluetoothSocket.connect(), hangs on InputStream.read(), can't disconnect after connect() Android BluetoothSocket.connect()引发IOExceptions“连接被拒绝”和“服务发现失败” - Android BluetoothSocket.connect() throws IOExceptions “Connection Refused” and “Service discovery failed”
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM