views:

557

answers:

0

Hi, I'm trying to mimic the success of gilead(http://stackoverflow.com/questions/2660968/) but so far his code in my app fails. I've tried multiple UUIDs but nothing works. When I run sdptool records [address] I get

$ sdptool records 00:12:F3:04:80:80 sdptool records 00:12:F3:04:80:80 Service Name: SPP Service RecHandle: 0x10001 Service Class ID List: "Serial Port" (0x1101) Protocol Descriptor List: "L2CAP" (0x0100) "RFCOMM" (0x0003) Channel: 1 Failed to connect to SDP server on 00:12:F3:04:80:80: Connection timed out

It shows the device is on channel 1 so I don't understand why the code does not work. I'm running Android 2.1. I cannot access the other device in any way and while debugging tmpsock has all the correct values before .connect() is called.

my code

public void test(BluetoothDevice d) throws Exception { BluetoothSocket tmpsock = null; OutputStream out = null; InputStream in = null; int port = 1; Method m = d.getClass().getMethod("createRfcommSocket", new Class[] { int.class }); tmpsock = (BluetoothSocket)m.invoke(d, port); Log.d("BT", "CONNECTING!!!!"); tmpsock.connect(); Log.d("BT", "CONNECTED!"); ... }