I have built an android app that can connect to a peripheral device by bluetooth(Classic Bluetooth) using BluetoothSocket.connect() and do some interaction with it. The app works well on Samsung Galaxy S3(4.3) and Note 3(4.3), but when on Nexus 5, the app can't connect to the device.
I have 2 Nexus 5, and both of them can't connect, what make me think there must be something wrong with Nexus 5, not me. But when I use the app supported by the manufacturer of the device to connect to the device, the connection always can be established, even using Nexus 5.
So I guess, there must be something wrong with Nexus 5 on classic bluetooth, what make it not very easy to establish a connection, and there might be some way to solve it.
Sorry for my poor English.Thanks for any pointers on how to solve this problem.
Here are 3 blocks of my logcat info:
logcat info of Samsung Galaxy S3(worked):
04-01 17:03:33.340 D/BloodPressureService﹕ connect to: 8C:DE:52:2C:68:6D
04-01 17:03:33.360 D/BluetoothUtils﹕ isSocketAllowedBySecurityPolicy start : device null
04-01 17:03:33.360 W/BluetoothAdapter﹕ getBluetoothService() called with no BluetoothManagerCallback
04-01 17:03:33.360 D/BloodPressureService﹕ setState() 0 -> 1
04-01 17:03:33.365 I/BloodPressureMonitorFragment﹕ MESSAGE_STATE_CHANGE: 1
04-01 17:03:35.095 D/BloodPressureService﹕ connected
04-01 17:03:35.095 D/BloodPressureService$ConnectedThread﹕ create ConnectedThread
04-01 17:03:35.105 I/BloodPressureService$ConnectedThread﹕ BEGIN mConnectedThread
04-01 17:03:35.110 D/BloodPressureService﹕ setState() 1 -> 2
04-01 17:03:35.125 I/BloodPressureMonitorFragment﹕ MESSAGE_STATE_CHANGE: 2
logcat info of Nexus 5 at the first time(worked.Don't know why, I never seen that before. But just one time):
04-01 17:14:37.577 D/BloodPressureService﹕ connect to: 8C:DE:52:2C:68:6D
04-01 17:14:37.577 D/BloodPressureService﹕ setState() 0 -> 1
04-01 17:14:37.577 I/BloodPressureMonitorFragment﹕ MESSAGE_STATE_CHANGE: 1
04-01 17:14:37.587 W/BluetoothAdapter﹕ getBluetoothService() called with no BluetoothManagerCallback
04-01 17:14:37.587 D/BluetoothSocket﹕ connect(), SocketState: INIT, mPfd: {ParcelFileDescriptor: FileDescriptor[47]}
04-01 17:14:39.207 D/BloodPressureService﹕ connected
04-01 17:14:39.207 D/BloodPressureService$ConnectedThread﹕ create ConnectedThread
04-01 17:14:39.207 D/BloodPressureService﹕ setState() 1 -> 2
04-01 17:14:39.207 I/BloodPressureService$ConnectedThread﹕ BEGIN mConnectedThread
04-01 17:14:39.217 I/BloodPressureMonitorFragment﹕ MESSAGE_STATE_CHANGE: 2
logcat info of Nexus 5 at the 2nd time(didn't work. And never work again):
04-01 17:14:59.977 D/BloodPressureService﹕ connect to: 8C:DE:52:2C:68:6D
04-01 17:14:59.977 D/BloodPressureService﹕ setState() 0 -> 1
04-01 17:14:59.977 I/BloodPressureMonitorFragment﹕ MESSAGE_STATE_CHANGE: 1
04-01 17:14:59.977 W/BluetoothAdapter﹕ getBluetoothService() called with no BluetoothManagerCallback
04-01 17:14:59.987 D/BluetoothSocket﹕ connect(), SocketState: INIT, mPfd: {ParcelFileDescriptor: FileDescriptor[56]}