繁体   English   中英

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

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

任何想法可能是导致问题的原因吗? 我执行connect()函数,不再执行任何代码。

码:

 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:

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.

任何想法?

我没有正确的UUID,我通过获取正确的UUID并将其替换为代码来解决它。

如何获取UUID:

ParcelUuid[] list = mmDevice.getUuids();

暂无
暂无

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

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM