Quantcast
Channel: Recent Questions - Stack Overflow
Viewing all articles
Browse latest Browse all 18035

Android BluetoothSocket.connect() throws IOExceptions "Connection Refused" and "Service discovery failed"

$
0
0

My goal is to write an app that allows me to control my Motorola Xoom with a Playstation 3 Bluetooth Remote Control.

The device is able to be discovered by the native bluetooth app & classified as being a joystick. However, I cannot pair via the native bluetooth app because the app requires a PIN & the device does not have a pin that I am aware of.

So far I am able to programmatically discover the device & create a socket, however all attempts to connect to the device fail.

In both cases:UUID u = UUID.fromString("00001124-0000-1000-8000-00805f9b34fb");

This is supposed to be the UUID used by HID devices. I also used the method described on another site to verify the UUID is available on the device.

Method1 (many people seem to have issues with this):

BluetoothSocket socket = device.createRfcommSocketToServiceRecord(u);socket.connect();

Result: IOException "Service discovery failed"

Method2 (the accepted workaround to Method1. I also tried ports 1-100):

Method m = device.getClass().getMethod("createRfcommSocket", new Class[] {int.class});BluetoothSocket socket = (BluetoothSocket) m.invoke(device, 1);socket.connect();

Result: IOException "Connection refused"

I have tried this code using 3 devices (plus their UUIDs):

  • Playstation Remote

    00001124-0000-1000-8000-00805f9b34fb

    00001200-0000-1000-8000-00805f9b34fb

  • Nintento Wiimote

    00001000-0000-1000-8000-00805f9b34fb

    00001124-0000-1000-8000-00805f9b34fb

    00001200-0000-1000-8000-00805f9b34fb

  • Microsoft Bluetooth Number Pad(which sucessfully pairs, with a pin, via the natvie bluetooth app)

    00001000-0000-1000-8000-00805f9b34fb

    00001124-0000-1000-8000-00805f9b34fb

    00001200-0000-1000-8000-00805f9b34fb


Viewing all articles
Browse latest Browse all 18035

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>