I\'m trying to open a socket bluetooth between a milestone and a pc but the device can not connect. I hope I am sending the code help.
public class Bluetooth
The createRFcommSocketToServiceRecord method is not working in Android 2.1/2.2. There is a workaround to call a non-public method to create the socket:
BluetoothDevice hxm = BluetoothAdapter.getDefaultAdapter().getRemoteDevice(device.getAddress());
Method m;
m = hxm.getClass().getMethod("createRfcommSocket", new Class[]{int.class});
socket = (BluetoothSocket)m.invoke(hxm, Integer.valueOf(1));
This is taken from the following question: Disconnect a bluetooth socket in Android
Regards, Michael