I am trying to establish a connection to another Bluetooth device on
my Nexus One (2.1) with the following code, which occurs when on the
broadcast receiver when a device is found.

BluetoothDevice device = (BluetoothDevice)
intent.getParcelableExtra(BluetoothDevice.EXTRA_DEVICE);
BluetoothSocket btSocket = null;

try
{
    btSocket = device.createRfcommSocketToServiceRecord(MY_UUID);
    BluetoothClass btClass = device.getBluetoothClass();
    Log.d("BLUETOOTH", "------ createRfcommSocketToServiceRecord
WORKED: " + btClass.toString());
    btSocket.connect();
    Log.e("BLUETOOTH", "ON RESUME: BT connection established, data
transfer link");
}
catch (IOException e)
{
    Log.e("BLUETOOTH", "IOException: " + e);
}

I have tried both the following UUIDs for both the SPP and OOP
profiles:

private static final UUID MY_UUID =
UUID.fromString("00001101-0000-1000-8000-00805F9B34FB");
private static final UUID MY_UUID =
UUID.fromString("00001105-0000-1000-8000-00805F9B34FB");

Every time I call the connect command I get an IOException with
"Service discovery failed". I have tried connecting to a G1, iPhone
and a Nokia phone all with the same results.

What am I doing wrong?

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to