BluetoothSocket accept()IOException

时间:2012-01-03 14:27:27

标签: java android bluetooth

我只对传出连接有这个问题。我从示例http://developer.android.com/guide/topics/wireless/bluetooth.html

中查看了源代码的大部分内容

因此我真的不知道这个问题的原因是什么......

首先发生IOException的代码:

try {
                // This is a blocking call and will only return on a
                // successful connection or an exception
                socket = mmServerSocket.accept();
            } catch (IOException e) {
                Log.e(TAG, "Socket Type: " + mSocketType + "accept() failed", e);
                break;
            }

每次我将手机连接到平板电脑时,accept()都会在手机上抛出IOException:

BluetoothChatService套接字类型:nullaccept()失败 BluetoothChatService java.io.IOException:取消操作

我认为这与此博客中描述的问题有某种关联: http://www.androiddiscuss.com/1-android-discuss/86844.html

顺便说一句,BluetoothConnection运行良好,但我的手机无法接收任何数据。

编辑:我刚刚意识到从我的Galaxy S到我的摩托罗拉Xoom的蓝牙连接无法与市场上其他流行的蓝牙应用程序建立......

如果我反过来连接,从平板电脑连接到手机,平板电脑就会重新启动。

1 个答案:

答案 0 :(得分:0)

这可能是身份验证问题。您的设备是否已配对?

相关问题