I was browing Stack and the internet for a simple solution to get the UUID of the device I'm currently using. I stumbled over posts like this but none of them seemed to help me.
The doc tells me about thisgetUuids() function but when going through the doc for Android Bluetooth I end up having a BluetoothAdapter but I need a BluetoothDevice to execute this function.
So I need to know the following:
1) Is the function returning really the device UUID? Because the name saids plural (getUuids)
2) How do I get an instance of this BluetoothDevice?
where, for instance, 0000111f-0000-1000-8000-00805f9b34fb is for HandsfreeAudioGatewayServiceClass and 00001105-0000-1000-8000-00805f9b34fb is for OBEXObjectPushServiceClass. Actual availability of this method may depend on device and firmware version.
I'm using SDK16 and it doesn't work for me. The uuids are null. Furthermore I'd like to have just my Bluetooth uuid. Do you know how to get this one?
– RonOct 29 '13 at 8:08
There is an uuid for each
Bluetooth service exposed by the device; that's why you see multiple
uuids for the smartphone. I performed the tests using SDK on Nexus S
with Android 4.1.2 and Galaxy Nexus with Android 4.3. Which device did
you use?
– Stefano S.Oct 29 '13 at 9:34
1
Bluetooth has to be on. I tested on a Galaxy S2 with Android 4.1.2 and it worked, showing 12 UUIDs.
– Stefano S.Oct 29 '13 at 13:10
2
Ok, thats great so far -
thanks :) But how do I get THE uuid representing my phone? Or do I need
all of them for identifying my devide?
– RonNov 4 '13 at 15:08
1
@Ron, have you got what you
wanted? I also want to ask. Is it okay if i define my own UUID for two
different android devices to communicate each other? I mean, wouldn't it
be conflict if I use the same UUID for two different device?
– gumuruhJul 7 '14 at 7:24