1. Check out our companion app, Forums for Android! Download from Google Play

Bluetooth - Can't Connect Out

Discussion in 'Application Development' started by mxrider108, Jun 21, 2010.

  1. mxrider108

    mxrider108 New Member
    Thread Starter

    Jun 21, 2010
    I am developing an application which uses Bluetooth to connect to a device and send/receive data. I am doing all of my testing with a Nexus One phone.

    I have never been able to establish a SPP (serial port) connection from my phone to any device. However, I have been able to connect from a device (my laptop) to my phone using a Mac equivalent of PuTTY (The only exception to this is the "Bluetooth File Transfer" app from the Marketplace seems to work, but I don't think that uses RFCOM/SPP...).

    I keep seeing this message in my LogCat logs:
    Code (Text):
    1. ERROR/BluetoothService.cpp(78): stopDiscoveryNative: D-Bus error in StopDiscovery: org.bluez.Error.Failed (Invalid discovery session)
    as well as these:

    Code (Text):
    2. java.io.IOException: Operation Canceled
    3. java.io.IOException: Software caused connection abort
    I have tried using the UUID of "00001101-0000-1000-8000-00805F9B34FB" and I have also tried using the:

    Code (Text):
    2. Method m = device.getClass().getMethod("createRfcommSocket", new Class[] { int.class });
    3. sock = (BluetoothSocket) m.invoke(device, Integer.valueOf(1));
    method instead of
    Code (Text):
    1. device.createRfcommSocketToServiceRecord(UUID)
    as well--with no luck.

    I am using the BluetoothChat example and variations of that code to do all of my testing...

    Solutions or suggestions would be great...or even a better/less complex example of some testing code I can run on the phone, or a python script or something I can run on my computer to help debug?

    Thanks! I hope this isn't a bug with the Android OS, but if it is I hope to find a workaround.

    I should also note that most devices show up as "paired, but not connected" in the Bluetooth settings


Share This Page