There is an apparent bug in the Bluetooth service discovery code, as has been mentioned by several people on several forums. The upshot is that the BluetoothSocket.connect( ) method consistently fails to discover a valid SPP service on some devices that are discoverable with non-Android devices while it consistently succeeds to discover the SPP service on seemingly identical devices. Obviously, the two devices are not identical but the fact is that I manufacture two such devices and there is nothing obviously different about them. I can consistently connect to both devices from a Windows Mobile app. I hope that Google will address this bug in the very near future. I will be willing to test any trial bug-fixes on my devices.
Here is the relevant log output from the failed attempt: 04-24 15:23:33.268: INFO/ActivityManager(82): Starting activity: Intent { cmp=com.thegadgetworks/.DeviceListActivity } 04-24 15:23:33.308: DEBUG/DeviceListActivity(8055): doDiscovery() 04-24 15:23:33.318: ERROR/BluetoothEventLoop.cpp(82): event_filter: Received signal org.bluez.Adapter:PropertyChanged from /org/bluez/7766/ hci0 04-24 15:23:33.318: VERBOSE/BluetoothEventRedirector(4213): Received android.bluetooth.adapter.action.DISCOVERY_STARTED 04-24 15:23:36.608: ERROR/BluetoothEventLoop.cpp(82): event_filter: Received signal org.bluez.Adapter:DeviceFound from /org/bluez/7766/ hci0 04-24 15:23:36.638: VERBOSE/BluetoothEventRedirector(4213): Received android.bluetooth.device.action.FOUND 04-24 15:23:40.368: ERROR/BluetoothEventLoop.cpp(82): event_filter: Received signal org.bluez.Adapter:PropertyChanged from /org/bluez/7766/ hci0 04-24 15:23:40.368: ERROR/BluetoothService.cpp(82): stopDiscoveryNative: D-Bus error in StopDiscovery: org.bluez.Error.Failed (Invalid discovery session) 04-24 15:23:40.408: VERBOSE/BluetoothEventRedirector(4213): Received android.bluetooth.adapter.action.DISCOVERY_FINISHED 04-24 15:23:40.418: ERROR/BluetoothService.cpp(82): stopDiscoveryNative: D-Bus error in StopDiscovery: org.bluez.Error.Failed (Invalid discovery session) 04-24 15:23:40.428: ERROR/BluetoothEventLoop.cpp(82): onCreateDeviceResult: D-Bus error: org.bluez.Error.AlreadyExists (Device already exists) 04-24 15:23:40.448: VERBOSE/BluetoothEventRedirector(4213): Received android.bleutooth.device.action.UUID 04-24 15:23:46.448: VERBOSE/BluetoothEventRedirector(4213): Received android.bleutooth.device.action.UUID 04-24 15:24:14.168: ERROR/BluetoothService.cpp(82): stopDiscoveryNative: D-Bus error in StopDiscovery: org.bluez.Error.Failed (Invalid discovery session) And here is the log from when it successfully connected: 04-24 16:09:02.337: INFO/ActivityManager(82): Starting activity: Intent { cmp=com.thegadgetworks/.DeviceListActivity } 04-24 16:09:02.437: DEBUG/DeviceListActivity(8230): doDiscovery() 04-24 16:09:02.457: ERROR/BluetoothEventLoop.cpp(82): event_filter: Received signal org.bluez.Adapter:PropertyChanged from /org/bluez/7766/ hci0 04-24 16:09:02.477: VERBOSE/BluetoothEventRedirector(4213): Received android.bluetooth.adapter.action.DISCOVERY_STARTED 04-24 16:09:05.079: ERROR/BluetoothEventLoop.cpp(82): event_filter: Received signal org.bluez.Adapter:DeviceFound from /org/bluez/7766/ hci0 04-24 16:09:05.117: VERBOSE/BluetoothEventRedirector(4213): Received android.bluetooth.device.action.FOUND 04-24 16:09:08.567: ERROR/BluetoothEventLoop.cpp(82): event_filter: Received signal org.bluez.Adapter:PropertyChanged from /org/bluez/7766/ hci0 04-24 16:09:08.567: ERROR/BluetoothService.cpp(82): stopDiscoveryNative: D-Bus error in StopDiscovery: org.bluez.Error.Failed (Invalid discovery session) 04-24 16:09:08.607: VERBOSE/BluetoothEventRedirector(4213): Received android.bluetooth.adapter.action.DISCOVERY_FINISHED 04-24 16:09:08.617: ERROR/BluetoothService.cpp(82): stopDiscoveryNative: D-Bus error in StopDiscovery: org.bluez.Error.Failed (Invalid discovery session) 04-24 16:09:08.877: ERROR/BluetoothEventLoop.cpp(82): event_filter: Received signal org.bluez.Device:PropertyChanged from /org/bluez/7766/ hci0/dev_00_0C_84_00_72_D2 04-24 16:09:09.167: VERBOSE/BluetoothEventRedirector(4213): Received android.bleutooth.device.action.UUID 04-24 16:09:14.647: VERBOSE/BluetoothEventRedirector(4213): Received android.bleutooth.device.action.UUID Please fix this bug! Thank you. -- You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en