Reputation: 267
I have been trying out the Bluetooth chat as per example in https://developer.android.com/samples/BluetoothChat/index.html, however my device (Nexus 7) is unable to pair/connect to my laptop (ASUS) using the example.
I am using the default UUID from the example. Is there anything else I have to modify in the codes to make it working? Below are my result from logcat when i try to connect.
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 have also tried various other Bluetooth chat example but faced with "unable to connect device" everytime.
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
Could it be this issue that prevent the devices from paring successfully? Any advice to get this working would be great!
Upvotes: 1
Views: 574
Reputation: 46
This may be problems with UUID.
Try to use UUID.fromString("00001101-0000-1000-8000-00805f9b34fb")
See for details https://www.bluetooth.com/specifications/assigned-numbers/service-discovery
Upvotes: 2