2017-08-26 84 views
1

我一直在嘗試藍牙聊天,如https://developer.android.com/samples/BluetoothChat/index.html中的示例,但是我的設備(Nexus 7)無法與我的筆記本電腦(華碩)配對/連接使用例。Android藍牙聊天示例不起作用,無法連接設備

我使用示例中的默認UUID。還有什麼我需要修改代碼才能使其工作?以下是我嘗試連接時從logcat得到的結果。

08-26 17:33:16.259 3834-3834/? I/art: Late-enabling -Xcheck:jni 
08-26 17:33:16.510 3834-3834/com.example.android.bluetoothchat 
I/MainActivity: Ready 
08-26 17:33:16.513 3834-3834/com.example.android.bluetoothchat 
D/BluetoothChatService: start 
08-26 17:33:16.521 3834-3834/com.example.android.bluetoothchat 
W/BluetoothAdapter: getBluetoothService() called with no 
BluetoothManagerCallback 
08-26 17:33:16.526 3834-3864/com.example.android.bluetoothchat 
D/BluetoothChatService: Socket Type: SecureBEGIN mAcceptThreadThread[Thread- 
479,5,main] 
08-26 17:33:16.526 3834-3834/com.example.android.bluetoothchat 
W/BluetoothAdapter: getBluetoothService() called with no 
BluetoothManagerCallback 
08-26 17:33:16.529 3834-3834/com.example.android.bluetoothchat 
D/BluetoothChatService: updateUserInterfaceTitle() 0 -> 1 
08-26 17:33:16.529 3834-3865/com.example.android.bluetoothchat 
D/BluetoothChatService: Socket Type: InsecureBEGIN 
mAcceptThreadThread[Thread-480,5,main] 
08-26 17:33:16.543 3834-3866/com.example.android.bluetoothchat 
D/OpenGLRenderer: Use EGL_SWAP_BEHAVIOR_PRESERVED: false 
08-26 17:33:16.554 3834-3834/com.example.android.bluetoothchat D/Atlas: 
Validating map... 
08-26 17:33:16.640 3834-3866/com.example.android.bluetoothchat D/libEGL: 
loaded /system/lib/egl/libEGL_tegra.so 
08-26 17:33:16.657 3834-3866/com.example.android.bluetoothchat D/libEGL: 
loaded /system/lib/egl/libGLESv1_CM_tegra.so 
08-26 17:33:16.691 3834-3866/com.example.android.bluetoothchat D/libEGL: 
loaded /system/lib/egl/libGLESv2_tegra.so 
08-26 17:33:16.738 3834-3866/com.example.android.bluetoothchat 
I/OpenGLRenderer: Initialized EGL, version 1.4 
08-26 17:33:16.748 3834-3866/com.example.android.bluetoothchat 
D/OpenGLRenderer: Enabling debug mode 0 
08-26 17:33:20.384 3834-3834/com.example.android.bluetoothchat 
D/DeviceListActivity: doDiscovery() 
08-26 17:33:25.394 3834-3834/com.example.android.bluetoothchat 
D/BluetoothChatService: connect to: 28:C2:DD:8C:30:BC 
08-26 17:33:25.401 3834-3834/com.example.android.bluetoothchat 
D/BluetoothChatService: updateUserInterfaceTitle() 1 -> 2 
08-26 17:33:25.402 3834-4016/com.example.android.bluetoothchat 
I/BluetoothChatService: BEGIN mConnectThread SocketType:Secure 
08-26 17:33:25.423 3834-4016/com.example.android.bluetoothchat 
W/BluetoothAdapter: getBluetoothService() called with no 
BluetoothManagerCallback 
08-26 17:33:27.479 3834-4016/com.example.android.bluetoothchat 
D/BluetoothChatService: updateUserInterfaceTitle() 2 -> 0 
08-26 17:33:27.479 3834-4016/com.example.android.bluetoothchat 
D/BluetoothChatService: start 
08-26 17:33:27.479 3834-4016/com.example.android.bluetoothchat 
D/BluetoothChatService: updateUserInterfaceTitle() 0 -> 0 

我也嘗試了各種其他藍牙聊天的例子,但每次都遇到「無法連接設備」。

I/BluetoothChatService: BEGIN mConnectThread SocketType:Secure 
08-26 17:33:25.423 3834-4016/com.example.android.bluetoothchat 
W/BluetoothAdapter: getBluetoothService() called with no 
BluetoothManagerCallback 

難道是這個問題阻止設備成功配對嗎? 任何建議,以獲得這項工作將是偉大的!

回答