I'm relatively new to Android and am creating a Bluetooth App on a Nexus 9 that will connect to a Bluetooth device application my coworker has written on an Arduino processor. I'm following this doc, which is very helpful:
http://developer.android.com/guide/topics/connectivity/bluetooth.html
However, to connect as a client I have to use this code, which uses this MY_UUID symbol.
// MY_UUID is the app's UUID string, also used by the server code
tmp = device.createRfcommSocketToServiceRecord(MY_UUID);
In the text the doc says: "The UUID passed here must match the UUID used by the server device when it opened its BluetoothServerSocket (with listenUsingRfcommWithServiceRecord(String, UUID)). Using the same UUID is simply a matter of hard-coding the UUID string into your application and then referencing it from both the server and client code."
This is confusing to me... does it mean it must match a UUID specified in the Arduino firmware?? My coworker who wrote the firmware doesn't know what that would be. When I sniff his firmware advertising, it has ID "RNBT-DFBC", but when I use that as a UUID I get an exception :
java.lang.IllegalArgumentException: RNBT-DFBC is not a valid Bluetooth address
And none of the sample Bluetooth projects I've looked at seem to explain the basis of this UUID value, they're just "magic numbers."
So... what on earth do I use as the parameter for my createRfcommSocketToServiceRecord() function? I feel like I am misunderstanding this, because a Bluetooth client cant possibly generally have such "intimate" knowledge of a server it wants to connect to. So sorry if it's a dumb question, but any help is appreciated.