I would like to know how I can connect to multiple Bluetooth server applications (written in Java) from Android mobile phone. Every server application has different UUID.
I referenced some code from Android's Bluetooth Chat application, but tmp = device.createRfcommSocketToServiceRecord(MY_UUID);
which seems to enable me to set what UUID to connect to, does not work on the application as it causes Service Discovery Failed Exception.
A workaround was found on another Stackoverflow question Service discovery failed exception using Bluetooth on Android where the solution is to replace the code above with
Method m = device.getClass().getMethod("createRfcommSocket", new Class[] {int.class});
tmp = (BluetoothSocket) m.invoke(device, 1);
The Bluetooth application now works with the desktop app like a charm, but it seems that with the new way of invoking Bluetooth socket via reflection, there is no way to set UUID that I want to connect to.
Is there any solution to the problem?